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

My infinite runner gets stuck in a while

My project is an infinite runner that goes right in a straight line. Sometimes when it just runs without jumping the Player stops. Sometimes the Player doesn't stop. When you jump the Player usually ...
0
votes
0answers
11 views

unity component architecture

Would it be sensible to split components into domains, then further by behaviour, and have behaviour component scripts act as an interface between OOP code and the Unity engine? domain > components ...
0
votes
0answers
19 views

Creating Slide-In Text [duplicate]

I want to make my text slide like so: This is from the game "Crossy Road". The movement is normally smoother that in the .GIF Here are some more frames from the GIF to make you understand what I ...
0
votes
1answer
36 views

How do I build a 3D array result set from a compute shader in unity?

I took this right down to the absolute most basic scenario but for some reason I can't get anything back from the GPU when this completes, could someone explain what I am doing wrong ... Here's my ...
0
votes
0answers
21 views

Help creating an animation in Unity? [on hold]

How can I create an animation that looks exactly like the one below (the moving hand pointer)? I have no idea on how to start. Thank you for your help.
0
votes
0answers
17 views

C# Launcher - C# Server Authentication

I know this topic is covered a ton on here, but I am having trouble getting a grasp on what tools to use in order to achieve this task. I built a simple game launcher in C# and plan to have a C# ...
0
votes
0answers
21 views

Abstract Factory Pattern for Implementing AdNetworks on Multiple Platforms [on hold]

Here's the link to the github project. I want to implement Abstract Factory instead of adding platform dependent compilation flags in just one file and make it ugly. Hence decoupled code. Moreover, ...
0
votes
1answer
49 views

Problem in Unity ad

I am trying to place ad in my game. i am using unity 5. trying to place admob in my game. in unity editor it displaying dummy message. tried to build the game in android phone after build completed ...
0
votes
0answers
22 views

How can library classes access SpriteBatch?

I have a spritebatch in my primary game component in a game project: public class GameRoot : Game { private SpriteBatch mySriteBatch; public SpriteBatch MySpriteBatch { get { return ...
-1
votes
1answer
110 views

Displaying Trajectory Path [on hold]

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
16 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
15 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]; ...
-1
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
15 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 ...
-2
votes
0answers
28 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
18 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
44 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
35 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
33 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
117 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
25 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 ...
4
votes
5answers
729 views

In Unity, how do I correctly implement the singleton pattern?

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
37 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? [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 ...
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 ...
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 ...
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 ...
0
votes
0answers
43 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
39 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

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
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
18 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
54 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
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 ...
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 ...
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. ...
3
votes
1answer
39 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
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: ...
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
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
1answer
23 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
71 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
66 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
79 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: ...