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
vote
1answer
716 views

Monogame shader not working

I'm trying to use this this tutorial in monogame, but the effect does not work, only renders a black screen. Everyhing by itself renders just fine, I looked at the render targets if they get drawn to, ...
2
votes
3answers
531 views

Camera follows player but how to stop camera moving when player moves

The player is moving automatically diagonally down the screen, and I have the camera as a child on the player. I would like the camera to always be following the player (who sometimes slows down / ...
0
votes
1answer
103 views

Most efficient way for nested loop to not repeat a value of parent loop in pair-wise structure (C# or Javascript) [closed]

It's hard to choose the correct title for this question, so let's see if I am able to better convey here what I am in search for. If the title is too far away, suggestions are welcome and I can edit ...
0
votes
4answers
288 views

Is database necessary? [closed]

Hi I have studied c# for good few months and I'm at intermediate level at the moment. And few days ago I decided to make simple 2D Games like "Mr Jump" after studying Unity. So my question is as ...
0
votes
0answers
116 views

Unity 5 2d array for storing game objects and their data

I want to have a 2D array which has a number of rows relating to the number of game objects and 3 columns. I want each row to have the name of the game object and its position and velocity. Is this ...
0
votes
0answers
78 views

Unity C# event handler not triggered

I am trying out a system in my game in which I have 3 classes: EventService: MonoBehavior EventStore (a normal c# class) EventViewController: MonoBehavior EventStore registers some callbacks to ...
1
vote
1answer
290 views

How to send data from Unity to Mailchimp

I have followed the WWWForm script reference to try to connect Unity with Mailchimp. According with the log, the form is sent without errors. Unfortunately Mailchimp did not stored any data. This is ...
1
vote
0answers
145 views

Is it a good idea to use the RDM socket type for multiplayer games?

I am currently developing a MOBA/RTS style game with an authoritative networking structure. Of course, the server needs to send a big number of packets every second, answering requests from the ...
0
votes
1answer
163 views

How can I adjust steer angle based on speed in Unity?

I'm following this (https://www.youtube.com/watch?v=kAEpLX3rfms) video on how to make a car in Unity. But my car doesn't lower the steering angle based on the speed of the video. The idea was that you ...
1
vote
2answers
766 views

Unity set ui image as active onclick

I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just ...
3
votes
1answer
244 views

How to implement visibility graph pathfinding in Unity/C# to detect paths (i.e. visibility connections) efficiently?

I am struggling with implementing continuous path-finding trough visibility graphs. Notice, I know that grids can be used even when movement is not trough grids (e.g. Theta*). But for my current needs,...
4
votes
0answers
230 views

smoothly recenter view over time

I'm currently using the Google Cardboard SDK for Unity to build a fighter pilot simulator. What I'm currently trying to do is recenter the view(CardboardHead) smoothly over time when the user looks ...
3
votes
1answer
257 views

Local avoidance together with any-angle types of A* Pathfinding

Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do ...
0
votes
2answers
222 views

Fixing enemy behavior state machine in Unity

I'm working on a state machine for my game's NPC. The only thing I can't to get work properly is the hit sequence. The hits register. What I would like to happen is for the attack sequence (animation)...
1
vote
1answer
58 views

Per pixel collision for scaled textures in Monogame Windows Phone 8

I have some serious trouble with pixel-collision in my game. I am using the Matrix Scale parameter in Spritebatch.Begin method, to scale the content for each device's resolution correctly. ...
0
votes
1answer
55 views

In unity, how do I rotate a vector in relation to the player?

I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation ...
2
votes
1answer
189 views

Using XBox 360 controller in Unity game - game doesn't recognize axis movement

I have a problem with the usage of XBox controller in Unity game. I connected the controller to the PC and it works fine, I also managed to use it in the game itself - I'm using "A" button to fire and ...
0
votes
1answer
82 views

Can I use sin or cos for the non uniform rotation in unity 5? [closed]

I have few objects which I have to rotate on an ellipsoidal track and speed is changeable at the run time because its a betting game in which racing will be done so speed values will come from the ...
0
votes
1answer
64 views

Collision Detection in Wander behaviour

briefly, this is the overall look and feel of my game: I have a player and I have an enemy in my map. i tried to learn collision from SaladRaider Youtube channel. collision using chasing method works ...
0
votes
3answers
82 views

WaitForSeconds isn't working

I have a class which is changing the player speed. Here is the code: using UnityEngine; using System.Collections; public class MultiplySpeed : MonoBehaviour { public int multiplier = 2; ...
1
vote
2answers
171 views

Syncing items between server and client

I'm doing this game of mine, and I want to add the items to it. I'm already familiar with the basic concept of syncing data between server and client, Usually using sync state, that's what i've done ...
-2
votes
1answer
615 views

the object of type 'GameObject' has been destroyed but you are still trying to acess it [closed]

the object of type 'GameObject' has been destroyed but you are still trying to access it .your script should either check if it is null or you should not destroy the object my script is in c# w =...
4
votes
1answer
99 views

Creating three-dimensional biomes

I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between ...
0
votes
0answers
74 views

How do I use Bezier Curves in unity?

I have to rotate few objects on an ellepsoidal(Capsule shaped) track and at the run time speeds are assigned to the objects from the server as this is a betting game which I am developing in Unity 5 ...
1
vote
2answers
437 views

Textures rendering upside down and small with Pixel Shader in Mono Game but not XNA

I'm new to HLSL, attempting to use MonoGame to do some simple post processing effects. Here is my HLSL file, taken from one of rbwhitaker's xna tutorials (I would post the link, but can't post more ...
0
votes
2answers
4k views

How to detect mouse over for UI image in Unity 5?

I have an image that I have setup to move around and zoom in and out from. The trouble is the zoom can be done from anywhere in the scene, but I only want it to zoom when the mouse is hovering over ...
3
votes
2answers
1k views

MonoGame 3.4 Content Pipeline Extension missing reference

I'm pretty new to MonoGame and XNA in general. So was wondering how I could import custom content and make it work on any platform. So I came across Content Pipeline Extensions wanted to do it like ...
1
vote
1answer
316 views

Snake game tail

I am working at a 2D Snake Game in Unity. This is the head of the Snake: http://i.imgur.com/RrKr9cg.png And this is the Extension of the tail of the snake. It is added everytime I eat something: http:/...
0
votes
3answers
169 views

Game Slowed by Particles in XNA

I am developing an XNA game and am trying to improve the performance of the game by hiding objects that are not visible to the user. My first thought was to use a BoundingFrustum based on the camera'...
0
votes
0answers
72 views

State Machine help

I'm using a state machine for my enemy's AI. I've not worked with state machines before & followed Unity's live training on State Machines. I added a HitState to handle animation sequences. The ...
2
votes
1answer
449 views

Image target display in unity Vuforia

I am using unity 4.5.1f3 and using the Vuforia sdk 5.0.5.I have downloaded the sample project from the Vuforia site.When I tried to run the sample of Imagetarget project,it asked to add license key....
0
votes
0answers
92 views

How do I rotate an object on iTween path on a curved track in Unity 5?

I have 10 objects which I have to make run on an ellipsoidal track for which I am using iTween PutOnPath. The objects are running on the track but as the curved track comes the objects do not rotate ...
1
vote
0answers
115 views

Bold black bar on right side of game in Unity (Android)

I am trying to create an endless runner. I have already created a system to generate infinite backgrounds from an array of some. However, on running the game, I get huge black bar on the right side of ...
2
votes
2answers
1k views

How to achieve lighting like this in Unity for 2D games?

How could I accomplish a lighting effect something similar to this game?: I'm not talking about the shadows but about the glowing/lighting effect on the crystals and the torches. Anyone got any ...
1
vote
1answer
311 views

Monogame - Screen transition with fading

I'm trying to create a fade logic with Monogame for my screen transitions. I've read tutorials online but I'd like to work with Premultiplied Alpha for the fading. I've seen people add 1x1 pixels ...
0
votes
2answers
4k views

Press button event instead of onClick() in Unity

I want to add a nitro in my arcade game and i want to detect press UI button instead of click. unfortunately only onClick() event is available for UI button what kind of options do I have ? Thank ...
16
votes
2answers
2k views

How to design context menus based on whatever the object is?

I'm looking for a solution for a "Right Click Options" behaviour. Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is. Right ...
6
votes
3answers
966 views

How do I accept only one directional input per update?

I'm coding "Snake" as my first game and I'm facing the logical fail when pressing multiple keys simultaneously eg. { up, right}; {up, left}; {down, right}, etc. Snake is able to go back and forth and ...
2
votes
1answer
309 views

Modularization in a project

I'm writing a C# game in Mono, and I want the game to be as modular as possible. I've started by writing the whole Item (inventory) System of the game in a seperate .dll library But I've hit a problem....
0
votes
2answers
1k views

How to change alpha of a sprite through script in Unity

I have 4 buttons and they each flash when the button is pressed. However if you were to press a button, then while the button is darker (flashing) click another one, that button then stays dark. I ...
0
votes
2answers
47 views

Transparency temporarily lost from a rendertarget when drawn to for one frame

I have a transparent RenderTarget2D that I draw every frame. Before the first frame is drawn to the screen, an image is drawn to the render target. The image also contains some transparent pixels. ...
1
vote
1answer
862 views

Unity Texture2D raw data TextureFormat problem

I am trying to load raw image data into a Texture2D in Unity using LoadRawTextureData but I can't get it to work correctly. First I receive an array of bytes from an unmanaged function that captures ...
0
votes
0answers
74 views

How to change the Gameobject on a button click

Suppose I have a three gameobject(g1,g2,g3,g4,g5) and I have two button Next and previous.Suppose when i click on next button from g1 the object should move to g2,when i click on next button again it ...
0
votes
1answer
1k views

Unity3D - override main camera rendering for compositing effect

I'm fairly new to Unity and am having a bit of trouble understanding the rendering pipeline. I need to render the scene to four "windows," so that the viewport shows a 2x2 grid of the scene, each ...
1
vote
1answer
139 views

Unity Collision Doesn't Work when Two Players Instantiated

I am using Unity3D and I have a problem. I have a script which instantiates the player gameobject once you are connected to the server. I also have an attack script. When there is only 1 player on, ...
0
votes
1answer
131 views

An Object is moving but its velocity is 0

In Unity 5 I have an object move when I press a button, force is added as seen by the code below. Then once this force is added I print out its velocity. The problem is that in the console my first ...
2
votes
1answer
129 views

Given a 3d goal point and a turn rate in radius, find max speed to reach goal

I'm working on a 3d space sim with AI agents flying ships through space. I am trying to get them to follow a waypoint path nicely, which involves figuring out how fast they can be travelling and still ...
1
vote
0answers
79 views

Unity 5 Distributed Physics in Client Server Model

I have a server which controls a physics object via buttons, adding force whenever I click them. I want to be able to have a client connect and whenever the physics object has a reaction on the server,...
0
votes
2answers
61 views

Limit the boundary of Touch

a game that I currently working on is in a way that player should actually draw a rainbow on the screen by tap and drag gesture in order to make a hills for the car. but the issue that i currently ...
0
votes
1answer
420 views

Unity - SetActive() on GameObject dont works on child's objects

I have the following line of code: GameObject.Find("_obstacles").SetActive(false); It serves to leave an inactive object, but the children of this object are not getting with the same status. My ...