C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

0
votes
0answers
12 views

Good practices for game script structure?

I'm working on a third person platformer in the vein of the Ratchet and Clank / Jak and Daxter genre. I'm using Unity and learning as I go. One thing that I'd like to get sorted out before I get too ...
0
votes
0answers
5 views

Unity Failed to Repackage Resources

I was trying to integrate Admob into my unity game. I imported the Google Play Games plugin and the Admob Plugin , but I have been getting this error for the past couple days. ...
0
votes
0answers
19 views

Unity C# - Using UnityEvents or Delegates to handle multiple checking on update()

I am making a Behavior Tree made of IFs, my technical counselor told me that it was not necessary to use linked lists (as I have seen that it is a standard for BTs), so everything is basically checked ...
5
votes
1answer
41 views

Unity - Particle System Shuriken - Setting particles in code with random row in texture animation?

Good day, I'm attempting to randomly generate a space scene (quite large actually) in Unity through C# code mainly. So far, I've gotten stunning results up to what image #2 will show you. However, now ...
0
votes
0answers
18 views

Unity webgl, freezing on screenshot

I have a code that allows me to capture a screenshot and send the byte array to a server to be saved in the users profile, the problems are that I'm building for webgl So I can't use the application....
0
votes
1answer
39 views

How to do I make my sprite move when it's instantiated in Unity5?

Here's the code I currently try to use to move my instantiated sprite: time++; if (cow == 1 && time >= wait) { Cow0Walk(); } if (cow == 2 && time >= ...
0
votes
0answers
10 views

Unity 2D play animation with flipX then enabling and disabling GameObject “locks” flipX

I have a GameObject with an Animator that contains many different animations. In C# I switch between these animations with animator.Play("AnimName"). Some of the animations have the flipX property ...
1
vote
1answer
35 views

Certain lines in C# script not running on certain GameObjects in Unity

Sorry for the long question, but I'm being specific in order to avoid answers I've already considered. This is the weirdest problem I've encountered in Unity thus far. What's happening is that the ...
0
votes
0answers
29 views

MonoGame - Improving 2D array Spritebatch performance

I'm looking to improve the performance of my Draw() method for my tilemap. I've poked around for a few hours and done things like: Removed any new calls from the for loops where I'm drawing the tiles....
0
votes
0answers
10 views

Strange glitches with VolumetricLighting test scene (Unity)

I was going to test the VolumetricLighting test scene, but I faced a problem. After starting the game, I can see only some strange glitches on the screen. Also I get an error message in the console: ...
0
votes
2answers
43 views

Loading next scene when counter is down to 0

I am trying to let my Unity project load next scene when the counter I have is down to 0. However I am unable to do that for some reason. The way I am trying to do it by : int i = SceneManager....
-3
votes
0answers
27 views

How to animate 2d trees?

I know that artists can create an animation for a tree. But to allow my artist colleagues to work on something else, I'd like to animate trees programmatically. How could I achieve this in unity?
-1
votes
1answer
28 views

Unity 5 Deleting Large Quantities of GameObjects (around 10000 or more) from Hierarchy

I've screwed up on this one. I used a script to randomly generate trees in my scene. The reason I did this instead of using the Mass Place Trees function in the terrain editor is because the trees all ...
0
votes
0answers
10 views

Unity3D: iTween ValueTo() not working

I have the following code to animate the Camera's FOV change: public float fieldOfView; public Camera theCamera; public float animTime; private float origFOV; void OnTriggerEnter(Collider other) { ...
-5
votes
1answer
51 views

How can I detect when all numbers are a certain value?

I'm trying to write "you win" when all numbers are "green" (in this case, equal to the constant Fez.color.g). This is the script I have so far: void Start () { for (int SD = 0; SD < 10; SD++) ...
0
votes
1answer
33 views

Combat System - Class Objects as Package and Listener

So I've been trying to map out a combat system and I have an idea I'm laying out that I'm looking for a sanity check on, as well as suggestions. The idea is that all things that can do damage (...
0
votes
0answers
19 views

Rotation weirdly affects translation

I'm working on simple spaceship simulation. I can turn on/off engines with space, rotate vertically with w, s and horizontally with a, d. The problem is rotation weirdly affects translation. It looks ...
0
votes
0answers
11 views

Entity Transform Matrix Transformation (Movement and Rotation) Monogames

I started of by creating an Entity class containing a Transform property of Type Matrix which stores all the transformations such as Position, Rotation, Scale etc. I was able to move the entity and ...
0
votes
0answers
7 views

Syncing Legacy Animation PUN

I'm using the legacy animation system (not the mechanim one) and I am wondering how you actually sync it over the network. I tried doing it through the Photon View component, but that crashed the ...
0
votes
1answer
21 views

Xna c# picking model with Ray mouse cursor select the wrong model

i made a small 3D game and i just try to apply a basic sample from here : http://rbwhitaker.wikidot.com/picking for picking model by the mouse cursor. For that i use the Ray object and check if some ...
0
votes
0answers
46 views

FSM Covariance with derived type

I'm trying to implement a FSM in Unity. I want my controller to inherit from the PoV_FSM finite state machine. I want FSM states to implement the PoV_FSM_State FSM state abstract class. I'm getting ...
0
votes
1answer
27 views

Unity C# GameObject Clones Sharing the Same Script When I Don't want them to

I've been having issues with a game I've been working on for a while. It's a pretty big project. I'm having some issues with two tree prefab game objects sharing code, where I don't want them to. ...
0
votes
1answer
55 views

Untity Game Destroy all objects instead of one

I have two game objects with the same script. In the PicUpSys script I have this code using UnityEngine; using System.Collections; public class PicUpSys : MonoBehaviour { public InvSys _InvSys;...
0
votes
2answers
33 views

How do I find an object by type and name, in Unity, using C#?

I know that in Unity you can find an object of a certain type, using myObject = Object.FindObjectsOfType<MyType>(), but that only returns the first object in the scene it finds of that type. ...
0
votes
1answer
52 views

Generate a random number of enemies to appear on screen

I am currently trying to create 2d shmups. I am trying to: Generate a random number of enemies to appear on screen Whatever number is generated will then be added to my List (the list is used to ...
0
votes
0answers
36 views

Unity 5 iOS 10.1 app stalls with Wifi IPv6 network

So in my recent apple review I got the following report : We also discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.0.3 on Wi-Fi connected to an IPv6 ...
-6
votes
1answer
59 views

How do I make a jetpack in Unity?

I am trying to make a jetpack, in Unity, but I have a little problem. I can't make good flying controller. There are two input options: Control flying using a keyboard, and control movement using a ...
1
vote
1answer
38 views

Drawing & transforming matrices upwards

I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale. I get my expected results If I draw my objects from my root node in this ...
0
votes
1answer
31 views

How to create a line renderer with end point as the mouse position, but with a fixed direction

I have two objects with a line going from one to the other, like this: I want to create another line with a starting point one of the objects and an end point the mouse position, however still facing ...
0
votes
2answers
37 views

Unity Movement Help

i am making script something like in swing copters when player moves to Left to right when you touch the screen , but its on X asis , i made my script on Y Axis , But it only goes down when i touch ...
0
votes
1answer
21 views

unable to send or update data into my mysql database using unity

I am trying to save user scores into my data base so i have deveoped backend on php and mysql datbase. All the things are complete but having issues to send or receive data through my unity WWW class. ...
3
votes
0answers
62 views

How to disable Monogame pixel font antialiasing?

I am using Monogame 3.4 (I have held off upgrading to 3.5) and am on Windows 10. I'm drawing using the PointClamp setting (as suggested in this similar question). Whenever I render text with ...
0
votes
3answers
86 views

Check if all gameobjects are destroyed

I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero. ...
1
vote
1answer
53 views

Use Mathf.PingPong() from current position

I am trying to use Mathf.PingPong() from the current x, y and z coordinates and let it move along the x axis however now it moves too far and too fast. I know how I can speed down but what about the ...
0
votes
1answer
17 views

How to play GameObject (ParticleSystem) and stop?

Have a game where you've to shoot somethings and when you hit the GameObject I've should play. I've tried with Instantiate but I can keep shooting even if the gameobject is destroyed. What should I do ...
0
votes
1answer
36 views

Using Unity as a front-end GUI for a non-unity application?

I'm working on a game right now that is 2D, and grid based, and for a variety of reasons have decided making it in Unity wouldn't be worth the hassle I'd have fighting the engine. That said, I want ...
0
votes
1answer
38 views

Unity Player Movement Y Axis(Something like Swing Copters)

My Player moves on Y AXIS , but sometimes it doesnt go up but stucks in one place, Script is like in swing copters , when you touch it rotates to another side but its on X Axis , i took and made it on ...
0
votes
0answers
24 views

Loading the selected prefab in one scene

I have two scripts: LevelManager is the script for level selection interface. Loader script is to load the prefab in the scene. The problem is that I don't know how to link these two scripts. ...
-1
votes
1answer
13 views

QFont Access Violation?

I'm using QFont in C# (OpenTK), and I found that when I initialize the QFont object, it throws the AccessViolation exception. Why is this? It says that QFont is accessing protected memory. Here is ...
0
votes
0answers
24 views

XNA Randomly crashes if not attached to Debugger

My XNA game crashes after about 10 sec if not launched from Debugger. When I launch it from Visual Studio the game doesn't crash, but without the Debugger it crashes. I have no idea what happens. I ...
0
votes
0answers
25 views

Unity 2D Runner input.touches help needed [duplicate]

I got error in script or it's bug, I don't know. When I start the game first time it goes very smooth, but after I play sometime like 20 seconds, the player starts moving slower and slower, and at the ...
0
votes
0answers
49 views

Voxel terrain with heights based on biomes

I have a voxel based terrain generation which is created by using the perlin noise function. And it already divides the terrain in different biomes based on heat and rainfall. These are the functions ...
0
votes
1answer
37 views

How to access the component of a child object inside another child object using a tag?

As the question above, I need to access the collider component of a child object that is inside its parent object which is also a child to its parent object. I tried this line of code below but it ...
0
votes
1answer
18 views

unable to map one object position to another object over network

objective: I have a player which instantiate by network manager class. I want to map/sync its position/rotation to another object which is also instantiate by my player object. (what it i have tried) ...
0
votes
0answers
39 views

Unity Touch Movement Help Needed

I got error in script or it's bug, I don't know. When I start the game first time it goes very smooth, but after I play sometime like 20 seconds, the player starts moving slower and slower, and at the ...
0
votes
1answer
10 views

How to spin Imported FBX model 360* in unity3d

I have been trying to spin my imported wheel from blender 360* but when I do it, it doesn't rotate on the center (on one spot). I'm using C#. I have tried this: transform.Rotate(Vector3.forward, 5f -...
0
votes
1answer
23 views

Random Abstract Art Assignment

So I have a school assignment where we have to make a little program that makes random abstract art out of drawn rectangles. This is what is should look like: It's the top right element of the ...
0
votes
0answers
14 views

Camera Shake Problem When Player Scaling Up and Down

I want my player to have a bit of animation when he jump so i try to scale player down in y axis when he jump. My player is just a block of square. The camera is child of the player in editor ...
0
votes
1answer
31 views

Texture color change not working on custom effect [Monogame] [C#]

I'm new to custom effects (ex. pixel shaders) in monogame, but I've researched a bit and made some test effects. I've noticed that the color variable "Color.[color]" doesn't change the color of the ...
0
votes
1answer
19 views

Is it possible that elements in the StreamingAssets folder are not read in build?

I'm making a 2D game. In my StreamingAssets folder I have a JSON file with some info about inventory items (id, description, rarity, name, is stackable or not) and a png file which contains a pixel ...