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

Game State being skipped

One of my game states is being skipped (pressing space goes straight to the 'GameScreen' game state skipping the 'CharSelect' state). All help is appreciated. if (currentGameState == ...
1
vote
1answer
13 views

How can I once run For Loop in void OnGUI?

I want once run GUI on screen same Initialization a number. I try say my think In easiest way then please payattention to this code: I know my code don't need loop but I just show a simple code: ...
0
votes
0answers
25 views

2D Platformer AABB collision issues

Before anyone say that this questions already has a answer, I will list all the questions I read and tried: AABB collision resolution issues Trouble with AABB collision response and physics Hard ...
1
vote
1answer
51 views

Unity: C# Spell System

I couldn't find any proper tutorials in the internet how to make one so I tried it myself. I've written a base "Skill" class with methods like Cast(), DealFlatDamage(), ShootProjectile() and they all ...
-1
votes
0answers
24 views

What are the basic knowledment requeired to build a game using pure code aproach C# in unity3d? [on hold]

I'm asking this because when i try to do make a game just using the pure code c# approach, all the information about how to do it wasn't placed together in just one place, and i still don't have all ...
0
votes
0answers
14 views

How do you create test for unity variables that are set through the [SerializeField] tag?

I need to create some tests for a bunch of variables that are initialized via the editor, So in the script they are always null and can't be set publicly. Usually using the tag is a good way to ...
0
votes
1answer
35 views

Spawning random objects at random positions in the 3D world

My main character can move horizontally and not vertically. It can move from x = -4 to 4 and z = -4 to 4 (a square area). I don't want objects to spawn where my character can move but every where ...
4
votes
0answers
86 views

How to do Chromatic Aberration on a transparent background?

I have a problem with a chromatic aberration shader effect... If I produce the effect on a white background I get exactly what I want: But if I do the same effect on a transparent background I get ...
0
votes
1answer
23 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
24 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
36 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
76 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
50 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
45 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
59 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
79 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
136 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
50 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
24 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
54 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
32 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
62 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
58 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 [closed]

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
65 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
33 views

Help creating an animation in Unity? [closed]

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
27 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 [closed]

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
60 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
133 views

Displaying Trajectory Path [closed]

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
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 ...
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
137 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
752 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
48 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
48 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
73 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 ...