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
vote
1answer
76 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
61 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 ...
0
votes
1answer
35 views

Draw transparency

I want to draw a terrain in a Texture2D at runtime in order to make collisions work with Farseer Physics later on. What I need is to make some parts of my original texture, which is just a colored ...
0
votes
1answer
75 views

Trigger scene loading in one device from another device using Unity WWW class

I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is ...
1
vote
0answers
8 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 ...
0
votes
1answer
144 views

Delegation in unity C#

I have a game where I have balls bouncing and you shoot them. Since I need a way to end the level when the player shoots all the balls I though I would create a game controller script which will ...
10
votes
4answers
1k 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
290 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
1answer
75 views

Handling touch input with Event Trigger

I wrote a simple script to control my 'Player' object: using UnityEngine; using System.Collections; public class PlayerMovement : MonoBehaviour { public float jumpVelocity = 10; ...
0
votes
0answers
21 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
3answers
82 views

How to check distance between two different vectors?

So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car ...
1
vote
1answer
154 views

Questions about scaling in a 2d game in unity

Okay, so: I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ...
0
votes
0answers
16 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 ...
1
vote
1answer
81 views

How can I mask this CanvasRenderer?

I'm creating a text box that allows for selectable text, based off of Unity's InputField. An issue I am now facing is that the selection highlight does not respond to masks (The parent has a mask, but ...
0
votes
0answers
37 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 ...
0
votes
1answer
174 views

XNA game structure question

I see to be running into a problem here. I know it's easier to show code samples so here you go. This is my main game class namespace WindowsGame4 { public enum MoveDirection { Left, Right, Up, ...
1
vote
1answer
135 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
10 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
76 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
11 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
1answer
923 views

Simple heart container script for 2D game (Unity)?

I'm attempting to create a simple mobile game (C#) that involves a simple three-heart life system. After searching for hours online, many of the solutions use OnGUI (which is apparently horrible for ...
0
votes
2answers
67 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
154 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
31 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 ...
1
vote
1answer
831 views

Unity 5 How Do I Set Text of Text Component of Input Field

How do I set the text of the new Input Field's Built In Text UI Object in Unity 5+? myInputFieldText.text = "Text Value I Want"; The code above does not work to set the text inside of a ...
1
vote
1answer
209 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 ...
4
votes
1answer
773 views

Unity3D [C#]: How do I use a custom inspector to expose an array of polymorphic objects to edit?

[EDIT: based on some feedback, I pruned the example down to the base functionality of the bug we are trying to solve. The description below remains accurate, but the repro has been shortened to: ...
0
votes
1answer
13 views

Arrow key control on winforms RichTextBox

I am making a faux console using winforms for the game I am working on. Right now I am moving a '0' across the screen using the arrow keys. In order to provide fine grain formatting on the text, I ...
0
votes
0answers
15 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
43 views

Unity: UNetWeaver warning: SyncVar set from within property function. This will not set dirty flags. How to?

I was trying out the new Unity networking and I added the SyncVar attribute to one of my variables to be synced. I also have a property to get/set the variable and update the visuals when set. I set ...
0
votes
2answers
243 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
3answers
166 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
1answer
366 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
0answers
24 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 ...
0
votes
1answer
24 views

Resources.Load doesn't grab values of my child class

I have a parent class Unit, and child classes melee unit/ranged unit. The parent class holds uninitialized fields such as health, damage, etc. the child class sets the values of these fields in an ...
1
vote
2answers
338 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
156 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 ...
2
votes
0answers
29 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
74 views

[Unity]Making sure playermodel only moves 1 unit

I am doing a school assignment based off of the Unity3D tutorial 2D RogueLike (all code available here) In my version though, the movement is not turnbased and I am having some trouble figuring it ...
0
votes
1answer
18 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 ...
1
vote
2answers
334 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
73 views

How to deal with a many to many relationship between objects

In my game, I keep a list of all clients currently connected to the server and a list of all actors in the game. Each actor is "relevant" ( currently replicating ) to 0 or many clients, and each ...
0
votes
1answer
196 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
143 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
289 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
1answer
57 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 ...
0
votes
3answers
124 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 ...
1
vote
2answers
147 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 ...
2
votes
1answer
215 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 ...