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

Displaying Trajectory Path

How can I display trajectory path exactly as in this image? I have used void OnDrawGizmos, but that only displays trajectory in the editor and without any arrows like shown below. Trajectory with ...
-1
votes
1answer
12 views

Using VBO in Opengl. powered with c# TAOFramwork

I'm doing a 3D display for a big object. I've managed to display it with opengl primitives, so it's (very) slow Now i want to use the VBO optimization. But when i lost the focus on the opengl window ...
0
votes
1answer
12 views

How to adapt UV code to use a tilesheet that is “uneven”?

The tutorial has code that takes a tilesheet and builds a UV mapping: const float tileSize = 0.25f; public virtual Vector2[] FaceUVs(Direction direction) { Vector2[] UVs = new Vector2[4]; ...
0
votes
0answers
25 views

AddExplosionForce issue? [duplicate]

AddExplosionForce doesn't do anything with this script, even though a RigidBody is added to each CubeParticule... What's the problem? using UnityEngine; using System.Collections; public class Force ...
0
votes
0answers
13 views

unity game engine - documentation tool and writing good documentation [on hold]

What are some good document generators that will work nicely with unity and c#? I have seen Doxygen, and that's a strong contender. What others exist? And are there any sleek custom Doxygen themes and ...
-1
votes
0answers
28 views

AddExplosionForce not working? [on hold]

AddExplosionForce doesn't do anything with this script, even though a RigidBody is added to each CubeParticule... What's the problem? using UnityEngine; using System.Collections; public class Force ...
-1
votes
2answers
18 views

NullReferenceException Error? [on hold]

I'm getting the following error when I run the code below: NullReferenceException: Object reference not set to an instance of an object GameObject Particules; void Start() { ...
-5
votes
1answer
43 views

Which Language for Suitable for Develop game in Unity? [on hold]

I am starting to Develop a game in Unity.I have good knowledge in Java and Android. In Unity ,only C# and JavaScript are used. I know Java,I get confused in Choose a C# or JavaScript.Give me ...
0
votes
1answer
30 views

Mode 7 in xna/monogame

I want achieve a view like Mode 7 from snes games where the closer textures get stretched out more and more far away textures look smaller. Something like this: What I have in my project at the ...
0
votes
0answers
23 views

Difficult to implement Microsoft XNA Platformer Example Enhancement

I implemented the platform logic from the XNA Platformer Example, but it have few annoying bugs, like this one: I wasn't able to fix it by myself, so I searched a lot and found this question: ...
3
votes
1answer
58 views

Problems with converting from Screen Space to World Space

I have an unproject function I've written, which takes in x and y values between -1 and 1, and a z value between 0 and 1 (0 is near plane, 1 is far plane). I create a vector off of this, and multiply ...
5
votes
2answers
115 views

Finding cells within range on Hexagonal Grid

First up - I know I'm being super-dense here. With that out of the way, I'm trying to write a C# implementation of this algorithm: var results = [] for each -N ≤ dx ≤ N: for each max(-N, -dx-N) ≤ ...
-1
votes
0answers
24 views

Make Camera follow target only on Y Axis? [on hold]

The script (attached to Main Camera) below makes the camera follow a specific target smoothly. But it follows the target on the x and y axis. What changes do we have to make so the camera follows the ...
4
votes
4answers
652 views

Correct way to implement Unity Singleton

I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating and validating a singleton. Is ...
-2
votes
0answers
33 views

Rebuilding Unity Project from DLLs? [duplicate]

I have lost my Unity project which was on my hard drive. Fortunately, I have found some files that were associated with my project. See here. Now, I have successfully converted Assembly-CSharp.dll ...
0
votes
3answers
35 views

How to access UI elements in a canvas in UnityUI

I am looking for elements on a canvas (a textfield and a slider); so I can retrieve values and pass them to a function. But so far I can't figure out how to access them; I can see the methods of the ...
-1
votes
0answers
56 views

Rebuilding Unity Project? [on hold]

I have lost my Unity project which was on my hard drive. Fortunately, I have found some files that were associated with my project. See here. I have successfully decompiled the DLL's to C# with a DLL ...
0
votes
0answers
42 views

Unity 5 Command not being sent

I have a client server build in Unity 5. I want to send a command from the client to the server with a GUI button click, this is for testing purposes. So on my client all I want is to click a button ...
1
vote
1answer
44 views

Darkness Emitting Light Source Unity

I was wondering if it was possible to create a light source in Unity, one that "sucks" light from the environment. Negative value does not seem to work in Unity, as pointed out by many. It is quite ...
1
vote
0answers
21 views

Farseer Engine Texture To Polygon Center of mass bug

I am new to Farseer Engine used with MonoGame so I decided to do some test with the API to see the results and learn. If I understand, in Farseer the Position property of a Body object is located at ...
0
votes
0answers
40 views

Game loop architecture using WPF(MVVM) and C#

Could i get some suggestions on how to implement a game loop whilst using WPF(MVVM) and C#, I am a professional developer and understand the technology well. The game loop usually contains a Init(), ...
0
votes
3answers
38 views

can someone help me with this code for my platformer. ive been working on the script for an eternity but unity keeps saying there is an error [closed]

using UnityEngine; using System.Collections; public class player_controler : MonoBehaviour { public float moveSpeed; public float jumpHeight; // Use this for initialization void ...
0
votes
1answer
43 views

In Unity, how do I make a mesh change its opacity during runtime?

I'm trying to make a isometric game. I want to make it so that when the player goes behind a wall, the wall's alpha goes down. How do I go about doing this? I have this code that I made, but I don't ...
0
votes
1answer
33 views

Add singleton to an existing gameobject in Unity via script

I did notice that if I assign scripts that generate singleton classes (for my managers), to an empty game object, everything works fine. Now I would like to start the scene with the empty game ...
0
votes
0answers
17 views

Custom bitmap font in XNA 4

Hy, brains. I'm making custom bitmap font processor and have a trouble with correct rendering. In details I have a font presented as png tile map with white characters on magenta background and I draw ...
0
votes
1answer
52 views

How to save variables into a file unity

I've wanted to save progress of my game (i don't have the code , sorry) without using PlayerPrefs. If it's possible ; with UnityEngine.
0
votes
1answer
57 views

Unity3D - Using AddRelativeForce to push an object forever in zero gravity environment

Ok, I use AddRelativeForce to basically push an object. But it suppose to keep flying and keep accelerating as I hold down the key because I didn't set gravity. I just started Unity3D last month, so ...
1
vote
1answer
27 views

Design basics for Unity game: sport management type

I am planning the classes for my game; and I am having problems to figure out the best way to connect them. In my game I do not have the classic structure of say a FPS; where you have the player ...
0
votes
1answer
45 views

How to load sprite from JSON?

i know how to load text, but idk how to load texture from json.. this my c#: public void soalbegin(){ filepath = System.IO.Path.Combine(Application.streamingAssetsPath, "soal.json"); ...
4
votes
1answer
52 views

Is this converting from or to premultiplied alpha?

I found this code buried under some rocks: var divAlpha = 0xff00/color.A; var r = (byte) (color.R*divAlpha >> 8); var g = (byte) (color.G*divAlpha >> 8); var b = (byte) (color.B*divAlpha ...
0
votes
0answers
48 views

what makes good component base code in unity engine? [closed]

I have read a little on it, but still don't think I can appreciate what makes for good, maintainable component based code. Please suggest some principles to consider? As is, I really dislike the code ...
-1
votes
0answers
89 views

Endless Runner Games [closed]

I am new in game development. I want to make a endless runner game in 3d using unity game engine but i don't know where to start my game. How can I get any type of reference related to this type of ...
1
vote
1answer
56 views

Unity C#: Game Object Movement Issue

I'm trying to move a game object within a set x and y range. I thought the code below would work, but it does nothing. The idea is the player controls the platform and tries to move under the ball. ...
3
votes
1answer
38 views

Unity camera tilt

I'm programming a camera for an RTS and I'm stuck on tilting the camera up and down. I want the camera to tilt between 20 and 70 degrees using the Z and X keys. This is my code: using UnityEngine; ...
1
vote
1answer
47 views

Monogame scale/resizing texture without stretching the borders

I would like to scale or resize my texture2d but when I do it, the texture border becomes stretched. Here's an example : This is my original texture And this the texture after I change the Scale: ...
1
vote
2answers
115 views

Can I make this physics simulation any faster?

I've made a little real time physics simulation that solves some bodies. CirclevCircle && CirclevOrientedRect I would like someone to tell me if I'm doing something drastically wrong. I know ...
1
vote
1answer
26 views

How to change the Value in HSV color via scripting [Unity]?

I have a glowing object(point light attached to a ball with a default shader with the emission property) in my scene and I've added a script to make the point light flicker. The script randomly ...
1
vote
1answer
21 views

Can't call GameCenter in my Unity game for iOS

I'm trying to integrate Game Center into my Unity 5 project and facings troubles. It seems that authentification is OK when the game starts on iOS device, a notification appears, but leaderboard ...
0
votes
1answer
70 views

When using Unity 5, is there a way to print/save/identify the last n lines of code that were executed at a specific point?

So, here is what I am after. Is there a way to identify which were the last n lines of code that were executed in Unity 5 (with C#) at a given point of the game? I know I can use Debug.Break() to set ...
3
votes
1answer
65 views

How to propagate component updates? (Changing components at runtime)

Whenever an entity is being added to an entity controller (which is essentially just a bag of entities), I scan through it's components to figure out if I need to register additional entity processors ...
0
votes
2answers
78 views

Is it possible to trigger a loop with key input

Ok I need to know if it is possible to trigger a gameloop with a key press? ex code if (GamePad.GetState(PlayerIndex.One).Buttons.X == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Up)) ...
1
vote
2answers
88 views

How are methods like Awake, Start, and Update called in Unity?

I'm developing with Unity 5 and I know that there are some methods you can use like in the code below: public class MyGameElement : MonoBehaviour { private void Awake() { } private void ...
1
vote
1answer
22 views

FileNotFoundException while using ShaderbyteCode.CompilefromFile method

I'm currently learning SlimDX, I want to load a Shader from tutorial which is named "triangle.fx" and it is in a folder called "FX",everything is in my solution. When I'm typing this line of code: ...
1
vote
2answers
87 views

How to rotate camera using mouse?

I'm looking for a basic example of rotating camera using the mouse. the only problem is I'm not sure of how to rotating the camera around it target. should i do this by an algorithm or is there a ...
1
vote
2answers
43 views

Continous repeatable object/image moving horizontally unity3d

I want to move objects on the screen horizontally. And the user has to pop the object by touching it. When user touch it, it gets destroyed and new object comes randomly. For experimenting, I used ...
0
votes
2answers
52 views

XNA's GameTime.ElapsedGameTime.TotalSeconds isn't working as expected

As I've seen at quite a few website, the best way to handle variable frame rate and movement (moving projectiles, monsters, swinging swords)... looks something like this: //This position += ...
1
vote
1answer
64 views

How do I make 2 players from one Class?

I am teaching myself XNA and only started a few days ago. I am making a clone of Pong and have made a class for the Paddle: I am wondering how I can create 2 paddles one for each player from the ...
0
votes
0answers
17 views

Animation bugging out and returning to idle state whilst moving - Unity 5

So my problem is this, my character, when moving side to side is fine and all animations play out fine. But when moving up and down he glitches back to his idle state. I have it set so that when ...
1
vote
2answers
47 views

example for creating button programmatically

Can someone give me an example of programmatically (not using a prefab) creating a button in Unity 5 using C# that has the following features? a text on the button (that I can change) an ...
1
vote
2answers
47 views

transform.Translate only for 10 units?

How can I transform.Translate (Vector3.up * Time.deltaTime * 2); a GameObject for 10 units? I mean only make it go up 10 units (10 y units).