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

2
votes
1answer
154 views

Physics not working when game is running on device Unity

I have my bouncing ball game. The ball bounces up when it hits the ground and when it hits the left wall it changes direction to right and when it hits the right wall it changes direction to left and ...
1
vote
2answers
57 views

Waitforseconds is skipping over

I have a function for a timer using waitforseconds but instead of waiting for how long I want to, it just skips it. A ui text should become "foo" then 5 seconds later become "bar" but it turns to ...
3
votes
1answer
86 views

Non linear scaling to show a sol system

In a sol system 2d simulation I have some problems in showing the entire system (ie: eaven planets far away than saturn ) letting distinguibles the nearest planet orbits. Actualy a use a simple ...
0
votes
0answers
73 views

How Can I Make These Collisions Work Outside Of Unity's Built-In? (C#)

I'm having some trouble working out what's wrong with my code. Basically I want to have my player be able to collide with obstacles it's flying through. So I have an obstacle, and a pathway or two ...
0
votes
0answers
32 views

How should I organize multiple materials?

I'm making a tile-based game, in which many tiles will be of the same type, and so I want to avoid having the same texture for all of them. I'm thinking of having multiple textures for those widely ...
2
votes
2answers
180 views

How can I get the pressure of a touch in Unity?

Does anyone know how to get the getPressure function from the Android API into Unity? Or is there another way I can access the pressure of a touch?
0
votes
1answer
44 views

Sprites not showing (C# - XNA 4.0)

I'm following a tutorial from XNA GPA, but in my project, none of the sprites are loading. I've followed all of the instructions exactly, and the code works as expected when I copy it from my project ...
0
votes
0answers
73 views

Unity3D - Unable to attach script to GameObject prefab at runtime

I've got a script that manages a scene browser within my application where I'm hoping to generate a new button instance for each scene found. I've put together a button that I've made into a prefab ...
0
votes
2answers
625 views

How to stop objects pushing each other away on collision?

I'm creating something along the lines of Super Smash Brothers. There's a problem with the collision between the two players and projectiles. We have rigid body on the characters and projectiles and ...
1
vote
1answer
105 views

Keyboard.GetState() only work first time, and Memory increase (not Disposing) [closed]

EDIT UPDATE 3 I been searching the web for a solution and found several people struggling with Memoryleak using MonoGame while trying to dispose objects. It could be the case that MonoGame should be ...
-1
votes
1answer
50 views

Get current position of instantiated prefab

I wrote two little scripts to manage platform spawning. 1st - is attached to the Spawner gameObject. It's uset to spawn new platform. 2nd - is something like Platform Manager which not extend ...
0
votes
0answers
30 views

XNA 2D Tile Baseed Map Collision Messing Up On Inside Corners

I'm creating a 2D Over the head game and the collision system works fine for straight walls and outside corners although not for inside corners. The walls are done by each solid tile having a ...
2
votes
1answer
284 views

How does Unity load asset bundle dependencies and how can they be accessed?

Loading assets from an asset bundle is done explicitly. You give the bundle the name of the asset to load, then it returns it( either now or later. ) However, loading dependencies is done completely ...
18
votes
7answers
2k views

How can I avoid tight script coupling in Unity?

Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem? For example: I want to have health and ...
-1
votes
2answers
66 views

How to enable and disable scripts on a Game Object?

This worked briefly yesterday, I believe I did something to mess this up. All my inputs that I put in are correct; therefor, it must be the code. I want to switch players. While the red cube's script ...
1
vote
1answer
66 views

Random movement of game Object staying in a circle

I want to write a script which makes several objects move in a random direction but within a range around another game object. If the parent object moves then that range should also be changed ...
0
votes
0answers
22 views

How do I extract the UV data from an FBX file?

I've written a FBX file loader for my 3D graphics application. The FBX file was created with Blender and saved in ASCII format. I'm having trouble converting the UV data. In the file is the following: ...
1
vote
1answer
93 views

How to get rid of jerky movement in scrolling? C# / XNA

I'm having a bit of trouble with my code meant to create a scrolling background of random-ish ones and zeros. When moving to the right (or left), it scrolls smoothly for a few seconds, stops/jerks, ...
3
votes
2answers
64 views

Efficient parsing of text file to map

I am creating a roguelike which will use an ASCII based tile set. There is a text file that represents the map (ie. walls, floor, items). I believe the next steps are to read this file in and use a 2D ...
-2
votes
1answer
24 views

showing Load 'name' (-1) couldn't be loaded because it has not been added to the built settings even after adding it

I have created 3 scenes (StartMenu, Game, Win) and added all of them to built setting with proper arrangement. StartMenu Scene has a button start which should take game to second Game Scene when ...
1
vote
0answers
12 views

Amazon IAP V1 not working on unity

I've been following the tutorial for amazon iap v1 (because it seems a lot easier than amazon iap v2) but when I built the android app and went onto the shop screen the app just force closed. Here's ...
11
votes
4answers
2k views

How do you allow networking code to be written in the later stages of the development?

I'm currently in the early progress of writing a game which I eventually will want to improve in most aspects. How can I skip out on writing network code yet leaving it fairly easily implemented, that ...
0
votes
2answers
353 views

How to stop rotation every 90 degrees?

I was facing another rotation problem yesterday, that i managed to solve by rotating the object like this : transform.Rotate (speed * Time.deltaTime, 0, 0, Space.World); I tried almost every other ...
0
votes
0answers
27 views

How can a text asset be added to an asset bundle using C#?

As far as I can tell assets can only be assigned an asset bundle through the editor. Is there anyway to assign an asset an particular asset bundle in C#? Specifically a text assets? I'm trying to ...
0
votes
0answers
17 views

Problem with cameracliping unity

Hello GameDev Community, i've got a small problem with figuring out a way to do cameracliping in the unityengine with raycasting i got two main problems the first being that my camera flicks ...
0
votes
0answers
49 views

Facebook integration issues

I have a "weird" problem with integrating Facebook in my game. The problem is that i can not see the scores of all my fb friends. (I have a high score panel where i visualize my fb friends best ...
1
vote
1answer
138 views

Raycast Flashing problem

Can anyone tell me what is wrong with me code? If you can see, whenever the player is in range of the raycast, the enemy turns red. But for some reason, even when the player has meet the requirement ...
0
votes
0answers
15 views

Creating a skinned mesh with SlimDX for DIrect3D9

I'm trying to convert a mesh into a 'Blended Mesh' using the ID3DXSkinInfo interface(wrapped by SlimDX). I am expecting that the resulting mesh contain blend weights but they do not. Here is code to ...
0
votes
0answers
80 views

Why do 100 rect contain 400 tris?

I am making a game targeted towards mobile, so I am experimenting around to know how I can boost performance. Now I have a rectangle with a road texture on it. This I made in Blender. And as expected ...
1
vote
0answers
13 views

Reading messages from a certain client in Lidgren

I'm setting up a game with Lidgren, and I was wondering if there was a way to read a message from a certain client instead of just from the server as a whole, such as- //Why doesn't this exist? ...
0
votes
2answers
73 views

Need Help with Hovering Mouse Code

I am new to Unity and C#. I have a script here for a card game where my card is supposed to move up and down when the pointer is hovered over the card. But when my point hovers over each card, they ...
2
votes
3answers
228 views

How do I make an endless road in Unity?

Basically I created 2 quads side by side and I added a road texture. I used transform.translate so that the road moves, but I am trying to make the road endless by making the 2 quads reposition ...
0
votes
2answers
37 views

How can I easily assign an array in the inspector?

If you make a public array class member in Unity, you can individually assign objects to the array in the inspector menu. It looks like this: However, this is cumbersome if you you want to assign ...
0
votes
0answers
21 views

Update part of dynamic Vertex Buffer. SharpDX

I'm creating application to draw simple 2D charts in a fast way. Updating my VertexBuffer is implemented as below: Device.ImmediateContext.MapSubresource(_signalVertexBuffer, ...
0
votes
0answers
25 views

Cutting shapes out of the terrain

I am trying to use Farseer Physics to cut out shapes from my terrain: // contains all vertices of terrain List<Vertices> terrainVertices = new List<Vertices>(); // makes a crate into ...
2
votes
0answers
30 views

Lidgren not starting server properly

I have a server set up for my game with Lidgren, and it works well when I have it set up on one machine, but if I try to run the server on another machine, I am unable to connect from other machines. ...
0
votes
1answer
27 views

2D Lock x Axis on character

I am creating an endless runner with a flying character. I want to lock any movement in the x axis so that the character object can only move up and down but still move forward through the scene. I ...
0
votes
1answer
201 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 ...
1
vote
1answer
172 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 ...
1
vote
2answers
174 views

How to programmatically change sprite sheet sub-sprite name

I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point ...
-1
votes
1answer
44 views

Cloning a gameObject which use properties similar to original gameobject

How to make clone of gameobject have the same properties as the original gameobject just placed right to it and the clone should fire exactly parallel to original character. Every property should be ...
0
votes
0answers
53 views

Store Player Stats

My character creation order is: Select Race, Select Class, Assign Bonus Stat Points, Customize and Name the character. Because I am using Unity's UI components I am using scripts attached to empty ...
0
votes
1answer
32 views

Adding a function call to a prefabbed button in Unity

For each of my scenes, I have an empty GameObject _Manager that stores my scripts for setting up the level, keeping track of variables, etc. On my main screen, I have a play button that isn't ...
0
votes
2answers
122 views

What are the steps to instantiate a button in Unity?

Given a Canvas test_canvas containing a Button test_button and an empty GameObject that manages instantiation and scripts and the like called test_manager, what are the steps to instantiate this ...
0
votes
0answers
18 views

Unity Asset Prefab Bug ThirdPersonController (left rotating bug) Unity 5.1.1f

I've been struggling on this for an entire week. There is a very annoying bug in the ThirdPersonController Prefab. Take a look at this video for better understanding. Once I turned 360° degree I ...
0
votes
2answers
74 views

Player rotation issues (Player returns to default forward rotation after releasing keys)

So basically what is happening is that my player rotates and faces the direction that he is currently being steered toward (which is wonderful). But after I release, let's say the A key, meaning he is ...
1
vote
0answers
48 views

Calculating orbital elements from Cartesian Vectors

I'm having serious troubles with getting my calculations to work. I'm calculating the orbital elements from a position vector, and a velocity vector. (I also know the distance and mass of the bodies ...
2
votes
0answers
61 views

360 Degree Snake [closed]

I'm using Unity / C# to make a variation on a 360-degree snake game, but I'm having trouble just getting the movement of the tail right (I have a similar problem as in this question: How To Approach ...
0
votes
0answers
47 views

Cell Loading System / Efficient Instantiation

|Summary| So essentially I am looking to create a system where the world is split up into cells. By cells I mean a square in the world that as the player approaches or retreats it decides if the ...
0
votes
1answer
144 views

Unity3D Interactive Cloth Basketball Net Falling Apart Though Not Tearable

I have a basketball net mesh attached to an Interactive Cloth with the following attributes: The mesh is not segmented and is not marked as tearable but as soon as the game starts the net falls ...