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

Change material emission for a second then go back to default

I'm looking for a way to change the emission of a material for a second then get it back to where is was by default Here's what I have for now float emission_lvl = 5.0F; float emission_lvl_start = ...
0
votes
0answers
22 views

Only Instantiate once? [on hold]

How do Instantiate only once? This script continuously create clones. GameObject[] cubeParticules; foreach(GameObject part in cubeParticules) { Instantiate(part, temp1, ...
0
votes
1answer
25 views

MonoGame-based animation system fails to change animation [on hold]

We have a problem with the animation. The problem is that it won't play the right animation. We are using a spritesheet with 4 frames: idle, movement and so on. Here's the code we are using: class ...
2
votes
0answers
66 views

Tower Defence stat storing system

I'm trying to find a smart way to store and retrieve stats for a tower defence game, but am currently unsure as to which approach would be best. Description: The stats system should quite basic, ...
0
votes
0answers
41 views

2d Lighting over Sprites in C#

I am currently working under a project , a small application where i have to implement 2d lighting . For example , in the GDI+ canvas , a image will be drawn and i will have to put a lighting effect ...
0
votes
1answer
40 views

How would I handle collision to all instances of one object? (C# and monogame)

What I'm saying is, let's say I have a list. That list contains all the tiles in the game. I use this to update them all, draw them all, etc. for (var i = 0; i < Tiles.Count; i++) { ...
0
votes
2answers
57 views

Get Particular Object's collision status via C# script

My current scripts creates and modifys the location of various prefab objects as they go along the screen. One of the things I want to find out about the active object is whether it has collided with ...
1
vote
1answer
74 views

In Unity, how can I modify the shape of a sprite?

I am new to Unity and programming in general, however, I wanted to know how to change a sprite's shape. I want to do this while the game is running, so I was thinking about removing a set of pixels ...
6
votes
4answers
127 views

How to properly differentiate single-clicks and double-click in Unity3D using C#?

What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse ...
0
votes
1answer
48 views

Set input relative to map rotation?

I'm trying to figure out how I can make the input which looks like this : // Checks if player is pressing movement keys, if is applies force to specified direction if ...
0
votes
1answer
23 views

Can 2D Rigidbodies detect collisions with 3D Box colliders?

I would like to know if Rigidbody2D's can detect collisions with 3D Box colliders and/or normal rigidbodies. I seem to have a problem where my 2D Colliders don't detect collision with my 3D Cubes. ...
3
votes
1answer
53 views

I want to render a texture2d on to the screen in unity, how do I do this?

So I have modified a texture in C# by removing all of its white pixels, now I want to render it on the screen in unity so that later I can use it as a terrain where I can make my sprite walk. So far, ...
0
votes
0answers
31 views

How to navigate through google Map in unity [on hold]

I am working on loading the google map and navigating through the map. I have loaded the google map which shows the current location in unity. Now I need to show the direction from Place A to Place ...
-1
votes
1answer
59 views

Bullet only removing closest enemy

I'm having an issue with my collision detection code. I'm making a top down shooter and when I shoot, the bullet will only destroy an enemy if it's the closest enemy. The bullet will go right through ...
1
vote
1answer
44 views

2d Player animation issue in UNITY 3D

I have a player and i want to move the player from left to right. I can move the player by the keyboard events.but the problem is that when i release the key the player animation should be idle. ...
0
votes
1answer
57 views

My character gets stuck when It's running on a straight level ground

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

unity component architecture [on hold]

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
33 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 ...
-1
votes
1answer
64 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
32 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
26 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
56 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
23 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 ...
0
votes
1answer
128 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
2answers
27 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
16 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 [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 ...
-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
49 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
40 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
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: ...
3
votes
1answer
71 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 ...
6
votes
2answers
136 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) ≤ ...
4
votes
5answers
746 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
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
0answers
47 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
24 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
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
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
70 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
36 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
21 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
57 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
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 ...
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 ...