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
1answer
11 views

How do I make this block go back to the left with another click?

This is the script I've written so far which makes the block move from the left of the screen to the right on a mouse click. What I want to achieve is for the block to move back to the left when I ...
0
votes
0answers
13 views

Developing Moddable game - Unity C# or Java LWJGL? [on hold]

So I'm about to start a new project (and no, this is not my first project) and I was wondering which of these would work better? I am not sure if it is possible to make a moddable game by Unity. I ...
0
votes
1answer
15 views

My Collider2D checkerscript not working [on hold]

So today I started working on my little android game but I ran into a problem whit my moving script. Whenever I jump I will be able to jump more than once.I have attached the script to the player and ...
-2
votes
0answers
19 views

Display game object one after the another [on hold]

I have two gameobject.I want to display one gameobject after another, after a specific time.How can do this I tried out with this code private bool showLabel = false; private bool showLabe2 = false; ...
2
votes
1answer
108 views

Unity access Label in GUI?

There is a quick and dirty appreoch to creating text boxes: void OnGUI(){ GUILayout.Label("Text 1"); } It works well. But, since the Label method returns void, how do I access this later on? ...
0
votes
0answers
42 views

Help slope tile collision platformer (XNA/C#) 2D

I have been creating a platform game in C# and XNA, everything works pretty well least the slope (down left and right). This is the project that I have so far. PlatformGameEngine.rar When the ...
0
votes
1answer
21 views

Unity GUIText not visible and not WYSIWYG

I have placed a Guitext in my hierarchy: At first it was visible, now I can't see it when I run the game. When it was visible: When modifying the position on scene, the GUIText appears on one ...
0
votes
0answers
9 views

How can I change the Color of the halo in unity [on hold]

I have created a gameobject called sphere.then from the component I have added halo and given the color green.After 3 sec the halo color should change from green to red .How can do this. ...
0
votes
1answer
13 views

Changing one prefab changes all other instances of that prefab too

I have made two prefabs of my enemies for my 2D game: normal and damaged. The I put several of these prefabs on scene. When enemies health <=0 I need to destroy its GameObject and then instantiate ...
0
votes
1answer
38 views

Smoother object movement in Unity?

I'm using this code in my script to move a gameobject: void Update () { // Move the object forward along its z axis 1 unit/second. transform.position = new Vector2(transform.position.x , ...
0
votes
1answer
30 views

NLua - How to implement Roblox like function security?

Roblox uses Normal Identities, basicly they assign a lua block/object to a certain number. They use 2 for Scripts and LocalScripts, which can only use non-secured functions, while the command bar can ...
0
votes
1answer
26 views

Access other scripts variables and classes of different directory

Im trying to learn how to access another scripts variable and classes of different direction, in Unity3D. But for some reason it keeps giving me the error. NullReferenceException: Object reference ...
0
votes
1answer
20 views

Unity - Sprite with collider2d hits a rigidbody - Searching for a way to make the rigidbody not to react

When a sprite with a box collider 2d hits the game object (rigid body), the collision detection is fired and I get the event. However, the sprite moves the rigidbody and I have trouble restoring it ...
0
votes
1answer
35 views

How to detect that user has touched UI canvas in Unity 4.6?

In my 2d game I have a HUD with some buttons on it. To make it I am using new UI system, which was presented in Unity 4.6. When user is touching button, I am running method, which was declared in ...
1
vote
1answer
26 views

How to make sure that all the UI elements were the same size on all screens in new Unity 4.6 UI system

I have made a HUD for my 2d mobile game with the help of the new UI system, that was introduced in Unity 4.6. But when I am trying to play game in Unity editor, the UI elements have normal size, but ...
0
votes
1answer
38 views

How to create particle system by script

I have created a gameObject called "Sphere". After 5 secs the gameobject starts rotating. Along with the rotation I need to emit partical from the object. How can I do this?
0
votes
0answers
35 views

Unity3D: Problem with enemies when they follow the character [on hold]

My native language is Spanish so sorry for the language. I began developing in Unity3D a couple of months ago and I have not had many problems. However, I am stuck with the script that makes the ...
2
votes
1answer
44 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
2answers
89 views

Restricting character movement to “rails”

I'm building a Pacman clone in Unity 3D and am now thinking about how to restrict the movement of the player to the hallways that the map is made up of. Basically, the player is only allowed to ...
0
votes
0answers
31 views

Deterministic random noise generator from multiple 64-bit inputs? [migrated]

I am trying to create a pseudo-random number generator in C# that produces the same output, given the same set of inputs. It needs to be fast, accept 64 bit numbers and, particularly important allow ...
0
votes
0answers
32 views

Beginner - How to get widht of quad with png? [on hold]

I have a huge Quad and a PNG as a child object. The PNG covers the whole game area / screen. The problem is I don't know how do I find out the width of the current game object!
0
votes
1answer
25 views

How to reference UnityEditor in external DLL when using UnityVS, successfully?

So I'm trying to put my scripts and custom inspector editor scripts in two external DLLs and I'm facing a problem on my Editor DLL. First of, I'm using UnityVS with Visual Studio 2013 Ultimate. I ...
0
votes
2answers
87 views

Creating Entities from Identifiers (C#)

I am writing a game in C#/XNA. Often, it's useful to have a function like this in a game engine: Entity CreateEntity(string id, Vector3 location) { ... } So that, for instance, you ...
0
votes
1answer
20 views

Adding SpriteFont in Monogame

My question is probably something you guys have heard before - "How do you add SpriteFont's in Monogame's content manager?" The simple answer to this is, right click the 'Content' folder, go on 'Add ...
0
votes
0answers
35 views

How can I determine the number of pixels drawn within a predefined shape on the screen?

In the image above, I want to know how can I calculate the number of pixels of the rendered players' shadows that are inside the elephant outline. An occlusion query is used to count the number of ...
-1
votes
0answers
14 views

System.AccessViolationException when instantiating a SlimDX.Direct3D9.VertexShader from pointer

I'm trying to instantiate a SlimDX.Direct3D9.VertexShader object from a pointer. I retrieve the pointer using the PassDescription object present in the compiled effect like so: try { // create ...
-3
votes
1answer
53 views

Direct raycasting from moving point A and moving Point B

I am attempting to raycast from Point A to Point A (both moving points). I dont understand the comcept of raycasting (direction). Update() { player = GameObject.FindGameObjectWithTag ("Player"); ...
1
vote
0answers
29 views

XNA Texture2D GetData [closed]

this is my code for creating Texture2D from depthFrame of Kinect : private short[] depthData; private Texture2D depthTexture; Color[] depthTextureData; if (null == this.depthData || ...
0
votes
0answers
36 views

Setting up a turn-based combat [closed]

I'm starting a little rpg in C# and ran into a bit of a problem with battling enemies. Battles functions as a series of turn-based interactions (rounds) between parties made of varying amounts of ...
0
votes
1answer
68 views

How can I raycast between two moving objects in Unity?

How can I raycast between two moving objects? I want to raycast from a moving enemy to a moving player. I dont know how to actually code to make the direction work. using UnityEngine; using ...
0
votes
2answers
57 views

XNA - Card Game - 3D vs 2D vs Primitives [closed]

I'm starting a new project in XNA which will be a card game. What is the best way to implement my cards? Since I want to rotate these, they'd have to be somehow displayed 3D. The game itself will be ...
6
votes
2answers
138 views

How can I draw a line of certain length and direction?

I want to create a line of certain length and direction. What I mean by this is drawing a line from Point A to Point B. Normally in Unity C# to draw a line from Point A to Point B is simply: ...
-1
votes
0answers
33 views

Respawn destroyed object in Unity

I have this script where as to when i hit a trigger my enemy spawns at a random time then the enemy destroy itself at a random time. I want to respawn the enemy again so it can do this over and over ...
0
votes
1answer
35 views

Height and Width of Player Depth View using Kinect SDK

This code shows that how we can find the player from the depth Image: this.depthData = new short[frame.PixelDataLength]; frame.CopyPixelDataTo(this.depthData); for (int depthIndex = 0; ...
1
vote
0answers
19 views

NegaScout with Zobrist Transposition Tables in Chess

I'm trying to put Transposition tables into my alpha beta scout. I do see an incremental speed boost I think toward mid or late game, however, even with a table size of 1-2GB, its may or may not be ...
2
votes
1answer
57 views

How do I spawn an enemy at one of many spawn points in Unity?

I have a spawn script that so far only creates one Enemy spawn point and enemy trigger while only spawning one enemy. Instead, I want it to create multiple spawns and triggers, but keep it such that ...
0
votes
2answers
110 views

How to show my XNA game in form C#

I have a game in XNA, I want to connect this game with WindowForm to show for example the distance and the position. I tried to apply many tutorials that talking about this. but here is my problem : ...
0
votes
0answers
27 views

raise an event when an object appears using HLSL and XNA [on hold]

I've written an HLSL code to make transparency of player using depth view of Kinect on the background image. this is my HLSL code : sampler stream : register(s0); sampler back : register(s1); sampler ...
-1
votes
1answer
37 views

Float increment give wrong result [closed]

I found something weird with my unity code : public class heroesscript : MonoBehaviour { float counter = 0; void FixedUpdate() { counter += 0.02f; print (counter); ...
1
vote
1answer
34 views

How to access an animation properties from the animator?

I'd like to change the property speed of an animation from the animator. For example, I'd like the player to be able to reload faster with upgrades. So I have a basic reload animation on the gun ...
0
votes
0answers
23 views

DrawBone Angle variable using Kinect

when we want to draw Bones into XNA (using KnectSDK and C#), you have to calculate differences between two joints and draw bones between them. this is the function for drawing Bones: private void ...
2
votes
1answer
70 views

How can I make Network.RPC call a method with params object[]?

Why do I need to do this? The game I'm working on fully conforms to a component style design. Every component that a game object uses is placed on the object and is disabled/enabled based on it's ...
0
votes
1answer
49 views

Casting a directional line of which an object is coming from

I want to create a directional line ( curve / linear ) depending where the direction is coming from. In some games, similar to Angry Birds, a dotted guideline is shown to provide where the gameObject ...
1
vote
0answers
39 views

How to initialize once for all a static field of a custom editor in unity

I have a custom editor wich has a static field. Suppose you have a static field of type MyObject: public class myEditor : Editor { ... private static MyObject myObj; ... } I'd like to ...
0
votes
0answers
25 views

Unity3D C#: How to resize an inputfield according the content which is set dynamic

I've got an InputField where the text is filled in upon getting a string back from the server. We can debug the entire text so we receive it correctly. However the text is too long to fit in our ...
0
votes
0answers
30 views

Monogame: Unsupported Landscape Screen Orientation on iOS 8.0

Did anyone have a fix on the landscape orientation problem that monogame has or is it the iOS 8.0 that has a bug? I have visited the github of monogame and tried to compile the latest developer ...
0
votes
0answers
21 views

Creating a ray with angle movement restrictions

In Unity is it possible to create a ray which has movement restrictions. As in creating a ray which is fixed to one point. When this point is moved around. The line is also moved around. But when the ...
1
vote
3answers
155 views

Responsibility of rendering in a component/entity game engine

I am developing a simple component/entity game engine in C# (https://github.com/alexvm/BlueShift) and have a few questions regarding the responsibility of certain items in the engine itself. I have ...
0
votes
1answer
65 views

Best way to go about collision between rectangle and bool array containing pixel data?

Basically, if I have an array along the lines of bool[] collision; Filled with a value for each pixel in the sprite I am checking collision against (pixel 1 = true, pixel 2 = false etc), how do ...
0
votes
1answer
59 views

Find index of GameObject in array of GameObjects

In my script, i have declared an array of GameObjects like this: public GameObject[] go;ld object name. `String temp;` Also, i have a temporary variable to ho Then, i assigned objects to elements ...