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

-1
votes
1answer
55 views

Moving an object continuously when left or right key is pressed

I want the object to move continuously as long as key is pressed to left when left arrow is pressed and to right when right arrow is pressed. Instead of moving continuously it moves first time and ...
0
votes
1answer
47 views

Incosistent jump, stuttering

I've written this C# code to handle movement in my testing project. The game is supposed to be 2D, some kind of a platformer, just to get me started with Unity. However, it seems there's something odd ...
6
votes
2answers
353 views

How can I debug live multiplayer servers effectively?

I have a multiplayer server made by a small team of developers and we have bugs that crop up on our live server occasionally that we simply can't reproduce while playing with our small team on a live ...
-1
votes
2answers
93 views

how would I go on about making a movement system like mario party

main question how would i go about getting a movement system similar to the one they have on mario party only minus the dice roll things i have researched so I have been studying the uses for ...
1
vote
0answers
73 views

How to use an A* Pathfinding System across uneven environments?

I am developing a game in Unity3D. I want an enemy character to follow the player around. The problem is, my surface is uneven and full of mountains. I am using aarongranberg's pathfinding project. ...
0
votes
2answers
41 views

Monobehaviour can not find a member OfType in Unity

This is the line where I am getting above mentioned error: var listeners = FindObjectOfType<MonoBehaviour> ().OfType<iPlayerRespawnListener> (); I have already imported these libraries ...
1
vote
3answers
164 views

How to create sprites, programatically without using prefabs?

I have different types of images for different sprites. and i am not certain that how much different sprites(images) i will have to show. So, i gotta create the sprites and apply textures ...
-1
votes
1answer
178 views

Disabling / Enabling object renderers on click

I am working on unity2d. I have six game objects: Object1, Object2, Object3 (these are images) ObjectImage1, ObjectImage2, ObjectImage3 (these are images). I have arranged the object in the scene ...
2
votes
2answers
407 views

Intelligently move aircraft using curves

I am trying to code a script to move an aircraft entity from point A to point B and at some point in the middle of moving have the aircraft forward vector face Point C (to fire a missile at an enemy ...
0
votes
0answers
65 views

How to block Kinect rotation

I'm developing a Kinect Project using C# and XNA 4.0. Now facing a problem that I couldn't solve. When the player turn around himself, the avatar doesn't turn, but its arms and legs are trying to ...
1
vote
2answers
449 views

How do you map a texture to a sphere in Unity using script?

I am looking to map a texture to a sphere inside of Unity using c# (not in the visual editor)? dragging a jpg or other image resource onto the sphere is the effect I am looking for -- but I would ...
0
votes
1answer
153 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 ...
1
vote
0answers
58 views

Having a hard time having consecutive animations for an attack [closed]

So I've been trying to figure this out for about 8 hours now...It's driving me nuts because I am pretty sure that it is something dead simple that I am just not understanding. I had everything working ...
1
vote
1answer
119 views

How to make an object move again after being stopped by collision in Unity?

I have a player object which position is always centered on the main camera's viewport. This object has a Rigidbody 2D, a box and circle collider. The player moves around a level, the level has a ...
-1
votes
1answer
46 views

How to use lemodev highscore plugin for unity?

I am trying to add a server-sided highscore system to my game in unity. I have downloaded the free lemodev highscore plugin from the asset store but I cant figure out how to use it. I know where to ...
1
vote
1answer
111 views

Vehicle: Boat accelerating and turning in Unity

I'm trying to make a player-controllable boat in Unity and I'm running into problems with my code. 1) I want to make the boat to accelerate and decelerate steadily instead of simply moving the speed ...
1
vote
1answer
62 views

Collisions and Lists [closed]

I've run into an issue that breaks my collisions. Here's my method: Gather Input Project Rectangle Check for intersection and ispassable Update The update method is built on object_position * ...
3
votes
1answer
84 views

Character creation using spritesheets

I am currently creating a 2D fighting game and have implemented a system where upon starting a new game, the player is presented with the option to create a custom character. I have a set of string ...
1
vote
1answer
64 views

Align tetrahedrons

I'm currently generating tetrahedron meshes in Unity When a player clicks the side of a mesh, a new one spawns aligned with it, like this. I'm not sure how nor can I find any information on ...
0
votes
2answers
88 views

Draw a never-ending line in XNA

I am drawing a line in XNA which I want to never end. I also have a tool that moves forward in X-direction and a camera which is centered at this tool. However, when I reach the end of the viewport ...
0
votes
1answer
53 views

Problem with sprite direction and rotation

I have a sprite called Tool that moves with a speed represented as a float and in a direction represented as a Vector2. When I click the mouse on the screen the sprite change its direction and starts ...
0
votes
1answer
252 views

Representing a world in memory

I'm attempting to write a chunk based map system for a game, where as the player moves around chunks are loaded/unloaded, so that the program doesn't run out of memory by having the whole map in ...
0
votes
1answer
797 views

Simple collision detection in Unity 2D

I realise other posts exist with this topic yet none have gone into enough detail for me. I am attempting to create a 2D game in Unity using C# as my scripting language. Basically I have two objects, ...
10
votes
2answers
1k views

What kind of steering behaviour or logic can I use to get mobiles to surround another?

I'm using path finding in my game to lead a mob to another player (to pursue them). This works to get them overtop of the player, but I want them to stop slightly before their destination (so picking ...
0
votes
1answer
65 views

Continous collision happening in Unity2d

I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer ...
1
vote
1answer
80 views

Unity Problem with colliding instances of same object

I want to check if object's instance is overlapping with another instance (any spawned object with another spawned object, not necessary the same object). I'm doing this by detecting collisions ...
5
votes
3answers
1k views

Differences between C# and Javascript for Unity [closed]

Apart from the language differences (class-based vs prototypical, strong vs weak typing), what are the differences between using Javascript and using C# when developing games in Unity3D? Is there a ...
3
votes
2answers
214 views

Using Behavior Trees and Events together

I am beginning to work with behavior trees and am unsure how events should be handled within the tree. Lets say we have a space game where the player is dogfighting with a handful of other ships, some ...
1
vote
1answer
59 views

Changing the object material without clicking on it

How can I change the object material automatically without clicking on it? The object material should change based on a timer.
3
votes
1answer
120 views

Characters With Interchangeable Skills

I am using unity and I would like to create characters that have interchangeable spells. As an example it would be something like Pokemon that can attain different skills as they level up and the user ...
2
votes
3answers
84 views

How to generate arrays of item types knowing just the ratio of distribution

I'm stuck to find a good solution about spawning enemies. Think of it as a tower defense game. What I'm trying to do is: Create keypoints for enemy types and spawnrates, as Wave0 = Enemy0 * 1.0 ...
1
vote
2answers
250 views

How can I keep chase camera behind player when player rotates?

I have implemented a follow camera in Unity 3D. However, if the player object rotates, the camera does not rotate with it. To fix this I used RotateAround as follows: playerRotation = ...
1
vote
2answers
761 views

How to pass an interface to Java from Unity code?

First, let me say that this is my first experience with Unity, so the answer may be right under my nose. I've also posted this question on Unity's answers site, but plugin questions don't seem to be ...
4
votes
1answer
532 views

How do I achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: But I noticed there is aliasing in my resulting image (the above image is a ...
-1
votes
1answer
51 views

Why does this code to render a triangle in SlimDX only show a black screen?

Here is the code: var elements = new VertexElement[] { new VertexElement(0,0,DeclarationType.Float3,DeclarationMethod.Default, ...
1
vote
2answers
161 views

Detecting Hitbox Collisions (Rectangle)

So I have some Hitboxes set up on 2 classes, HealthPickup and Player. public static Rectangle Hitbox; public override void Initialize() { Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32); } That's ...
-1
votes
1answer
124 views

How to add nice effects to my menu in Unity

I have a simple menu but I would like to spice it up with some of what I thought would be simple effects. I have 4 buttons that are just rectangle with some GUIText centered on the button and when the ...
7
votes
3answers
566 views

How do I translate a spherical coordinate to a Cartesian one?

Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me. I'm looking for something like this (ideally in C#): public Vector3 ...
3
votes
1answer
379 views

How to compress Unity apk output?

I made a game with Unity but the size of .apk file got so large, it is about 70mb... Is there some way that I can compress my apk file?
1
vote
1answer
150 views

How to create normal map from bump map in runtime?

I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it ...
0
votes
0answers
93 views

Looping Background in Unity

I am currently learning C# with Unity 2D but I have come across an issue after following a tutorial. I am trying to get my camera to follow my player within the game but also to get my background ...
0
votes
3answers
492 views

Why does this game loop stop my process from responding?

I implemented a fixed time step loop for my C# game. All it does at the moment is make a square bounce around the screen. The problem I'm having is that when I execute the program, I can't close it ...
-2
votes
1answer
282 views

Identify mouse click unity3d [closed]

I have a 3 fbx models. I want to have each model do something when selected. But I'm not sure how to get them selected. I have managed to drag the 3 models into the scene, but from here on, I am ...
14
votes
2answers
3k views

What is the standard C# / Windows Forms game loop?

When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured? A canonical Windows Forms application has ...
2
votes
0answers
99 views

How to implement simple shadows on XNA?

UPDATE: See photos below the description I try desperately to implement shadows on my XNA games. My game is a style of games like Voxel (minecraft). The problem is that I do not find support / ...
1
vote
1answer
91 views

Why does my object instantiation work, but return null? [closed]

For some reason, the LogError runs: Player clone = Instantiate(player, this.transform.position, Quaternion.identity) as Player; if(!clone) { Debug.LogError("WTF"); } else { Debug.Log("WE ...
-2
votes
1answer
273 views

How to make healthbar decrease in unity [duplicate]

I want to build a health bar which show's the energy of the player.I have two buttons "PLAY" and "IDLE" to show the animation.when I click on the "PLAY" button the character start running along with ...
1
vote
1answer
53 views

XNA Library DrawPrimitives throwing primitiveCount error

I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed. The classic teapot works but when I ...
5
votes
3answers
1k views

How can I build a game in Unity with minimum/no use of the visual editor?

I'd like to write a game completely in C#. In my search for an engine, I found Unity3D, but all the tutorials and documentation are speaking about a visual editor and the Unity IDE in which you click ...
0
votes
0answers
94 views

class instance issue

Currently, i am working on a project which deals with several parts. First, I want to interface with a Sidewinder Force Feedback 2 joystick in Unity using SharpDX and SharpDX.DirectInput libraries. ...