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
71 views

Unity3D Pathfinder with Crossings

I'm trying to bring traffic on my street system. The main problem for me are the different lanes and crossings and to make it complete the different types of paths. I've tried a bit with the ...
0
votes
0answers
15 views

unity game engine - documentation tool and writing good documentation [closed]

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 ...
6
votes
2answers
130 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) ≤ ...
-2
votes
0answers
30 views

AddExplosionForce not working? [closed]

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
20 views

NullReferenceException Error? [closed]

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
48 views

Which Language for Suitable for Develop game in Unity? [closed]

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
37 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 ...
1
vote
1answer
63 views

How to remove destroyed clones out of the Hierarchy in Unity2D

I made a 2D edge collider which on contact destroys the other gameobject. When I launch the game all the other gameobjects in fact get destroyed but the clones are still listed in the Hierarchy. How ...
0
votes
0answers
45 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 ...
2
votes
2answers
13k views

How to add a UI Text for keeping Score in Unity 5

My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: ...
0
votes
1answer
46 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"); ...
3
votes
1answer
67 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 ...
0
votes
0answers
35 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: ...
0
votes
1answer
315 views

Unity5 TextAsset not functioning in WebPlayer

Preface I am working on a 2D Platformer in Unity5 utilizing TileMap techniques. I have a working system to read "Room Tile Data" from JSON files with the Unity TextAsset Class and the Newtonsoft ...
1
vote
2answers
49 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 ...
-1
votes
0answers
27 views

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

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 ...
1
vote
4answers
1k views

Detecting on which side did the objects collided unity 2d

I have a ball and a rectangle in my game. The rectangle has a box collider 2d attached to it. How can I calculate or check when the ball hits the top of my collider, when it hits the bottom, left and ...
-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
42 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 ...
0
votes
3answers
213 views

Health bar - calculating health bar's position from percentage

I'm making a simple health bar in Unity 3D. Health bar UI is made from images. I'm having a problem with setting bar's position based on health percentage. Here's a script part: percentHealth = ...
2
votes
1answer
90 views

Drawing Farseer Fixtures

Is there any way how to draw a Polygon / Fixture from Farseer Physics with XNA? As I deform these polygons at runtime I can't take any texture from my Content folder, the texture must be generated at ...
0
votes
2answers
83 views

Best way to draw 2D shapes on a 3D flat object

I want to draw shapes (arcs, circles, lines) on a table, which is in 3D space. The table top is at Y=0 level and oriented so it points to (0, 1, 0). There are some other 3D objects on the table, so ...
1
vote
0answers
23 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 ...
-1
votes
0answers
57 views

Rebuilding Unity Project? [closed]

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 ...
1
vote
1answer
45 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 ...
0
votes
1answer
58 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 ...
0
votes
2answers
241 views

How to properly give Image source for multiple sources?

I'm writing a script to change the image on the button based on previous selection. Another script is giving the CurrentAvatar variable once previous button is pressed. My problem is i can't seem to ...
0
votes
0answers
44 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
1answer
60 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
3answers
41 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
55 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
34 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
19 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 ...
4
votes
1answer
53 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 ...
1
vote
1answer
165 views

How to detect collision position and that position's texture color in Unity?

I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?
1
vote
1answer
28 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 ...
1
vote
1answer
133 views

What can I do in Unity3D to optimize the way I'm calculating contrast of a texture2D?

I have this contrast script right now in Unity: public void ApplyContrast(string contrast) { try { double contrastD = Convert.ToDouble(contrast); //Make ...
0
votes
1answer
148 views

Monogame / XNA - Multple 2D Cameras (Rectangle) on screen

I recently started building a simple 2D roguelike game using Monogame 3.4. I was keen on building the game "engine" myself as I saw it as a fun learning curve. Monogame was pretty much the best option ...
1
vote
1answer
29 views

Unable to move mouse cursor while pressing keyboard button

I've a player to which I've attached character controller and two scripts - Controller and MouseLooker to control the player movements but when I try to move my mouse cursor while pressing keyboard ...
1
vote
1answer
57 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. ...
2
votes
1answer
348 views

How can I use a lookup table for brightness and contrast?

Currently, I implemented a rudimentary brightness and contrast algorithm that changes brightness and contrast pixel by pixel. This was super inefficient performance wise and the algorithm looked a bit ...
0
votes
1answer
298 views

Unity3d - c# - changing FPSInputController controls through script

For a game I am making I would like the user to be able to change the controls (in game NOT through the clunky launch window (wich i disabled)) I have the system working but don't know how to change ...
1
vote
1answer
49 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: ...
4
votes
2answers
503 views

Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...
1
vote
2answers
127 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
2answers
63 views

XNA makes the console flicker

I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() ...
1
vote
1answer
27 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
2answers
90 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
2answers
184 views

Help on transition from one position to another

I'm pretty sure I'm over thinking stuff, but I can't seem to figure this out. I want to move the object from one location to another. Here's what I got. I searched this up earlier here, and I found ...
0
votes
0answers
60 views

LibNoise Perlin.GetValue not returning noise for zero decimal place numbers

I'm using the LibNoise port from C++ to C# and running into problems generating Perlin noise (Unity demo here). For some odd reason integers never generate any noise. In the code below _firstValue on ...