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

3
votes
1answer
413 views

Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...
0
votes
1answer
172 views

Lightning bolt effect with particles is not continuous

I am Drawing a lightning effect animation using this image: Below the result: As you can see the outcome is not a continuous purple color as I wanted it to be, but it has black spaces in ...
0
votes
1answer
29 views

Touch Input with Event Trigger. How to handle with it properly

Hello Community, Since this is my first post I wanted to say hello. As every beginner developer I have a lot of problems. Below one of them: I wrote simple script to control my 'Player' object: ...
1
vote
1answer
114 views

Pixel Shaders To Create Predator Effect

I am learning shaders, and I figured I would try to use them to create sort of a predator effect. I got to the point where I rendered my level to a rendertarget and passed that to the shader file, ...
0
votes
2answers
110 views

Basic C# Script in Unity3D for firing a bullet (not working)

working on a 2D top-down view game. Im trying to get my player to fire a bullet when spacebar is pressed. I added a component to my player (a bullet sprite) and placed it under his gun (so you can't ...
0
votes
1answer
95 views

Center a 3D model to cursor's position

I am having a hard time understanding how to go about this. I have a 2D game with some 3D models in it. I want to move a 3D model to where the mouse cursor is currently at in every frame (In other ...
0
votes
2answers
123 views

Unity3D - How do I make so when user moves the camera it doesn't go beyond the scene borders?

How do i make so when i move my camera, it doesn't go beyond the border of the canvas while playing. This is the script i use to make the camera move: if (Input.touchCount > 0 && ...
0
votes
2answers
63 views

Moving a character depending on the direction he is facing (C#/Unity3D)

Right now I have a small soldier on the screen that moves with W, A, S, D and rotates / changes direction with the arrow keys. What I want to happen is when the player's direction changes (by using ...
0
votes
1answer
330 views

When should I set a texture as a shader resource in order to read it?

I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth ...
0
votes
2answers
252 views

What is the best type of c# timer to use with a Unity game that uses many timers simultaneously?

I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. There will be a GameObject containing 1 timer. For this game timer durations will ...
3
votes
2answers
82 views

Creating a countdown Timer in Unity

I want to create a countdown timer in a Unity game I am creating. Up until now my game was running for a specific time but I was using InvokeRepeating to end the game after the set time. But now I ...
1
vote
2answers
169 views

Create a continuous flight path on a Bezier Curve in Unity3d

I am working on a game in which a butterfly is flying along some path. What I am trying to do currently is create a Bezier curve starting from the butterfly's position(previous curves end point) and ...
0
votes
1answer
132 views

Getting Image name given a canvas WPF

I have a bunch of images I'm using for a chess game in a canvas using wpf, xaml, and C#. I want to use Canvas.SetTop(image, position); to set the position of this image. However I am given the ...
1
vote
0answers
23 views

Supported Orientation, Monogame, Windows Phone 8

I am developing a game in which I need to rotate the screen on Landscape mode or Portrait, and lock it that way. In Monogame, targeting Windows Phone 8.1 adding this code: ...
1
vote
1answer
31 views

How to properly activate trigger objects?

I have made a flying cat that follows the player, but I want the cat to be a separate object. Cat is following the player and as soon as it sees a collectible it grabs it for the player and then ...
0
votes
1answer
40 views

Why is C# method not showing up for button's On Click()

I have a C# script called MainMenu.cs Here it is in its entirety using UnityEngine; using UnityEngine.UI; public class MainMenu : MonoBehaviour { public Button btnPlay; // Use this for ...
1
vote
2answers
267 views

control animation using animator control class

I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given ...
0
votes
1answer
168 views

How to make a model parts glow one after the another

I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first ...
0
votes
1answer
73 views

CPU Usage and Available Ram in Unity 5

In Unity 5 I would like to be able to print out the CPU Usage and Available Ram left in MB. I followed the code posted on http://zamov.online.fr/EXHTML/CSharp/CSharp_927308.html and used it, however ...
0
votes
1answer
129 views

How to change the speed of the gameobject moving on the itween path

I have set an itween path for an object to move.And I have written the code as iTween.MoveTo(gameObject,iTween.Hash ("path",iTweenPath.GetPath("train"),"time",300)); The above code is working for ...
0
votes
2answers
220 views

How to procedurally generate Mountains that Looks more natural

My Terrain was looking a bit plain so to freshen it up a bit I decided to add mountains to the terrain generation. Unfortunately the Mountains don't look very natural with the surrounding terrain. ...
0
votes
1answer
98 views

How to move an 2D character(with animation) to mouse click position in C#?

i am going to develop a simple game called waste collection.In which if i click on a waste the character needs to walk to certain waste and collect it. Startingly the character is in the middle ...
0
votes
1answer
34 views

Unity animation editor having trouble to animate twice the same component

I'm not getting warm with the Unity animation editor. This is what I want to do: The 2 lasers should be like this, rotating 360 degrees over and over. .The classname laser2 doesn't mean anything, I ...
2
votes
1answer
202 views

How to impale and stack targets correctly according to the collider and its coordinate?

I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how: At the start, the falling object (in red) will fall in a ...
0
votes
3answers
95 views

Checking if object passed between two other objects

I have a three objects (strikers), lets say red, green and blue. When I apply force to the green object I want to check if it has passed between red and blue or not. See the image below for an ...
0
votes
2answers
139 views

How to make legacy animations run in Unity in unscaled time? (Pause game related)

I'm relatively new to Unity, and I've been having a very difficult time getting the legacy animations to run in unscaled time. I need to pause my game, and as soon as it pauses, I need to have my ...
2
votes
1answer
406 views

Why is OnCollisionEnter2D called when it's layer's collisions are being ignored?

I'm sure this is down to my lack of understanding of the unity physics system. I'm trying to implement a simple one-way platform for a 2d game and have got stuck on creating a reliable way to let the ...
2
votes
0answers
32 views

Cannot convert bitmap to texture

I'm doing a little C# / OpenGL project and I can't manage to load textures properly. So here is my texture class : public class Texture { public String Filepath; private int TextureID; ...
0
votes
2answers
164 views

animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator ...
5
votes
2answers
460 views

Black bars on 720p emulator?

I'm making a game for Windows Phone 8 using XNA 4.0 in Visual Studio express 2012. I'm trying to add a background image to the game with a size of 1366x768 (as I believe WP8 only supports up to 720p). ...
0
votes
1answer
63 views

Unity 5: Accessing a C# variable from Javascript

I've set up a SQLite database with Unity. Into this I would like to add the current CPU Utilisation. The SQLite scripts are in Javascript and the method for finding the CPU utilisation is in a C# ...
0
votes
3answers
2k views

How can I make RPC function calls in Unity?

I am making a multiplayer game. I am sending score via the server and client but I want to be sure that can I call an RPC function of a script from any other script. For example, say Table_Manager as ...
0
votes
1answer
100 views

Spawning moving text make it disappear overtime

I am trying to display a text when I click the letter 'R'. When the text appears, it should slowly slide down on the y axis only, slowly disappear over 4 seconds and get disabled. I am not able to ...
1
vote
2answers
432 views

Resetting a level in unity when exiting to main menu

I have a pause screen in my game having two buttons : resume game and exit to main menu The main menu have only 1 button wish is play, when i click on exit to main menu the main menu level is ...
0
votes
1answer
39 views

Instantiated Prefab Facing Wrong Way

Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.)) I've been having a lot of ...
0
votes
2answers
55 views

Unity 5: Error when everything is okay(Object reference not set to an instance of an object)

i'm getting this error when the collider colides with something: Object reference not set to an instance of an object It's referencing to the gamecont.Death(); from this script: and the death ...
0
votes
1answer
1k views

How to make custom shaped holes in terrain

So I'm trying to create a game where you fit certain shaped objects into the hole that fits them (similar to the young children's game with different shaped blocks) in Unity 3D. I've encountered a ...
1
vote
2answers
552 views

Sprite collision with color?

Is this possible? To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a ...
1
vote
2answers
80 views

Accessing a newly Instantiated Object

I currently am creating a script that allows the player character to attack by shooting orbs at foes. I have the current code to do that (not final code, for testing purposes): ...
2
votes
3answers
191 views

Jumping higher when the player touches a trigger collider in Unity

Im using Unity engine to create a 2D platformer. My character can single/double jump, this works fine everywhere except when i am in range of a collider with a IsTrigger set to TRUE, then my character ...
1
vote
3answers
148 views

Basic multiplayer matchmaking implementation

I am currently writing a matchmaking server application for a 5vs5 UDK game. Here is the scenario on which I built my code: The player starts the game and authenticate The player clicks an huge ...
1
vote
2answers
1k views

Octrees as data structure

In my cube world, I want to use octrees to represent my chunks of 20x20x20 cubes for frustum and occlusion culling. I understand how octrees work, I just dont know if I'm going about this the right ...
2
votes
1answer
48 views

Does the order in which RPCs are called match the order they are invoked locally?

For example: void A() { Debug.Log( "A was called." ); } void B() { Debug.Log( "B was called." ); } void C() { NetworkView view = GetComponent<NetworkView>(); if( view != null ) ...
0
votes
1answer
91 views

Unity how to change material properties at runtime

I'm working on a unity game where I want to change the color of a material from within a script. The material applies to a line renderer. I currently have the following script: using UnityEngine; ...
1
vote
2answers
1k views

How to add a UI Text for keeping Score in Unity 5

My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: ...
1
vote
1answer
5k views

Looking at the mouse position in a top down Unity game?

I'm trying to make a simple top down game where the player looks at wherever the mouse is pointed. The player is only going to rotate on the Y axis. Here's what I have so far but I can't seem to get ...
2
votes
1answer
341 views

delay camera xna

I read this tutorial http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Camera_delay.php but i didnot unsterstand it. Is there another way to delay the camera position movement without this ...
0
votes
0answers
35 views

Resize gameObject when it has extended a restricted area

So here i have an image will provide a better understanding of my problem. So currently i have some white blocks and within the white blocks i have some cyan bordered boxes. So the current problem i ...
0
votes
1answer
230 views

How to move the camera in XNA only after few moments?

I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the ...
3
votes
3answers
667 views

MMOFPS Choosing protocol for high-traffic network (UDP or TCP)? [closed]

my question about the player position sender protocol. In this article, he says "Never use TCP for networking a multiplayer game". Ok but UDP datas are not ordered. In this case, if somebody walking, ...