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
0answers
3 views

Making multiple VertexPositionColor variables in the same class? - XNA

I have studying XNA on my spare time for about a year now and I could use some professional help on this issue. Any time given to my problem is appreciated. I have two VertexPositionColor variables ...
0
votes
0answers
14 views

XNA/Monogame Draw() only show backgroundcolor

I'm making an 3D game with multiple DrawableGameComponents and 2 gamescenes. In one of the scenes I create a few new DrawableGameComponents: public ActionScene(Game game) : base(game) ...
0
votes
0answers
11 views

Problems with Raycasting Requirements

Im working on a script which kinda works like an Enemy AI. Its kinda like a detection system with requirements that are required to be met. This is a recent question i asked using my code Raycast ...
0
votes
1answer
11 views

Changing Light Intensity value

I have this code for creating a light: GameObject lightGameObject = new GameObject ("Light1"); lightGameObject.AddComponent (typeof(Light)); ...
0
votes
1answer
22 views

Cannot store value in transform.position.y

Well I have this line of code Vector3 pos = cell.CellPosition; float light1Height = 10f; pos.y = light1Height; lightGameObject.transform.position.y = ...
2
votes
0answers
40 views

Battle Engine for Text based browser game [on hold]

I am starting to code a browser game, I have a rudimentary chat set up, and would like to start creating the battle engine, I have a general idea of how I want it to play out, but I don't know where I ...
2
votes
1answer
181 views

Advanced Cellular Automata to generate caves

I am trying to make caves in Unity. To do this, I am trying to use cellular automata. I found the following(Rouge Basin Cellular Automata for Caves) that resembles what I am trying to accomplish. But ...
0
votes
1answer
18 views

Can't play animation from script in unity

I'm making a 2D sidescrolling game in Unity, and when the player shoots an obstacle, I want the obstacle animation to play and then destroy itself. I got it to destroy itself, but the animation won't ...
0
votes
1answer
21 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 ...
-1
votes
0answers
36 views

Unity 4.6 GUI C# - How To Dynamically handle events generated by any gui element

Hello thanks for your time! GOAL: What im trying to achieve is to create my own small event system for new ui 4.6 elements so i can manipulate them by code , in this small test project im trying ...
0
votes
0answers
17 views

Unity game works on iOS cannot start as apk on Android [on hold]

Im using Unity for my game and I exported it successfully to iOS. Now I exported the apk for Android and tried to install it. Here is the result after the installation: ...
-1
votes
1answer
19 views

Unity 2D collision detector not working

I'm making a 2D sidescrolling game in Unity where the player shoots at obstacles while running. But nothing I try seems to get the collision detection to work. This is the obstacle script: void ...
0
votes
1answer
22 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
1answer
16 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 ...
-3
votes
0answers
23 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
117 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
58 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 if the ...
0
votes
1answer
22 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
11 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
14 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
39 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
32 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
32 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
21 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
52 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
29 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
39 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 [closed]

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
2answers
56 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
93 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? [closed]

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
26 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
22 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
36 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
18 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
54 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
1answer
70 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 ...
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
34 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
58 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 [closed]

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
36 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 ...