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

Creating a Timer in C# Unity

In my game I have watch video earn coins system, now I want to program a delay so the user cant watch the video every 5 seconds, for example I want to let him watch every 6 hours, but I'm not sure how ...
0
votes
3answers
34 views

How to Color.Lerp between multiple colors?

I have found it rather difficult to find a solution to this in the Unity documents. Color.Lerp(Color a, Color b, float t) is a function that gradually changes a color according to a step t, giving it ...
0
votes
1answer
28 views

Pause in Seconds and resume in unity

I want to pause 15 seconds then resume without any input when an object is collision other object this is my code but not working. Thank you void Start(){ Eifftower = ...
0
votes
0answers
18 views

C++ or C# for 2D Game Development [on hold]

I am a python programmer since two years and I wanted to delvelop a REAL game now. So I decided to choose between C++ and C#. I should also mention that I mainly want to program games compatible on ...
5
votes
2answers
146 views

In Unity, why is adding a Vector2 and a Vector3 only sometimes ambiguous?

Given the following two vectors: Vector3 pos = new Vector3 (1f, 2f, 3f); Vector2 dpos = new Vector2 (1f, 2f); This line is ambiguous: transform.position = pos + dpos; // Unity reports dimension ...
-1
votes
0answers
26 views

Rotation problem with Quaternion.Euler in unity [on hold]

void Rotate() { Vector3 lastDirectionInGlobal = _camera.ScreenPointToRay(rightFingerLastPoint).direction; Vector3 currentDirectionInGlobal = ...
0
votes
1answer
44 views

Unity forward vector flips when upside down. Mario Galaxy style gravity, bad rotation?

This is a question that I think is best to explain visually, so I will do my best to be succinct here. What I am trying to do: Allow the player to run about a world that is spherical, not a flat ...
0
votes
1answer
34 views

XNA - Darkening background and drawing something on top

In a game a group of friends and I are working on using XNA, we wanted to create an effect where we could darken the screen and draw something else on top of the darkened portion. For example, we have ...
0
votes
1answer
71 views

XNA game structure question

I see to be running into a problem here. I know it's easier to show code samples so here you go. This is my main game class namespace WindowsGame4 { public enum MoveDirection { Left, Right, Up, ...
-3
votes
0answers
49 views

How to make monster a collection system? [on hold]

How to make monster collection system like this?: and Can you recommend any useful design pattern or examples?
0
votes
1answer
38 views

moving object in unity from a point A to point B no matter what the original position of the object is

I'm moving a Game Object in unity from point A to point B no matter what the original position of the Game Object is. Let us suppose that I have a Game Object at (0, 0, 0). But I want to move that ...
0
votes
1answer
29 views

XNA/MonoGame RenderTargets not working

I'm having a problem with drawing 2 RenderTargets to the screen. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using ...
1
vote
2answers
53 views

Drawing a pixel to RenderTexture

I would like to know how you would go about drawing a single pixel to a RenderTexture in Unity. In XNA, it was just a matter of setting the graphic device's active renderTarget, and drawing to it. ...
0
votes
0answers
21 views

swap rotation problem in mobile game (unity) [on hold]

using UnityEngine; using System.Collections; [RequireComponent (typeof (CharacterController))] public class Camera_rotation_onSwap : MonoBehaviour { public bool kJoystikEnabled = true; public float ...
0
votes
0answers
25 views

Unity 5 profiler shows Vsync graph even if disabled

My game suffers from some lag spikes over time, wich match with the Vsync graph in the unity 5 profiler. I deactivated Vsync via script and the quality settings but the lag is still there and the ...
-1
votes
1answer
53 views

Why can't I access List<T> through System.Collections.Generic? [on hold]

I have the following small and incomplete script, and I was wondering if anyone knew about this issue. I'm trying to access System.Collections.Generic.List<T>, but I keep getting the error The ...
-6
votes
1answer
56 views

MMO game made with Unity [on hold]

this is my first post in stack exchange i am currently making a 2D MMO game with Unity 5 and Bolt engine for the networking but i realized that a friend of mine has already made a Fan based game ...
1
vote
1answer
47 views

Simple Tanks game - Client-Server communication approach doubts [on hold]

I want to create simple a multiplayer 2D game with tanks ( cooperative ) in C# with .NET. I also want to keep it simple, because it is only a semester project, and unfortunately i don't have time to ...
0
votes
0answers
21 views

How can I change the gear of my 2D character? [duplicate]

Is it possible to change the clothes of a 2D character(it's a 2D Windows Phone game) without creating new animations for that character? I want that the player can change the clothes of the character, ...
0
votes
1answer
41 views

Calculate 3D “up” vector to align ship to an arbitrary axis

I'm writing a script to control the movement of a 3D ship in a game. Given the ship's position and the coordinates of the destination, I've successfully calculated the Yaw and Pitch necessary to aim ...
0
votes
0answers
25 views

Rotate the camera on a given angle

Good day! I apologize in advance for my bad english. The task is as follows: "On the stage there is a camera and a gun with rays when a ray gun out of sight of the camera (vertical) is required to ...
0
votes
1answer
36 views

XNA Rendering Blocks

I am currently building a little game in XNA and found something strange. I want to draw many blocks next to another (1x1x1 with a texture on the side) So what happens when I do it this lines ...
-2
votes
0answers
31 views

Impassable Tiles With XNA/C# [closed]

I can't get this to work for the life of me and I'm not entirely sure why, as I'm checking whether the tile is passable or not. I have a Tile class which contains a tileIndex, a tileSet and a boolean ...
2
votes
2answers
79 views

How do I rotate and object around itself, and translate it at the same time?

I have this animated gif of my problem. I have a sprite object with a box collider, and I'm trying to rotate it around its center. My rotation script consists of this : this.transform.Rotate (0, 0, ...
3
votes
3answers
133 views

How to achieve high Level of Detail on 3D models

I'm developing a 3D space-based game which allows free movement in all directions and features planets. Currently I am using the Visual Studio content manager to import models (spheres) with 2D ...
0
votes
1answer
19 views

Unity animation editor having trouble to animate twice the same component

I'm not getting warm with the Unity animation editor. This is what I want to do: The 2 lasers should be like this, rotating 360 degrees over and over. .The classname laser2 doesn't mean anything, I ...
-1
votes
0answers
25 views

how to add specific line when it cross another line?

two lines ; one of them cross the other, it is like collision between those lines, I need a method to detect collision between lines and how to put this specific line when we detect a collision! ...
-2
votes
0answers
96 views

unity 5 C# or Unreal Engine 4 C++ [closed]

now with unity 5 and unreal engine 4 both going for AAA graphics(unity) and free(UE4) which is a better choice...i have been working with unity for the past year and C# is boring to program...UE4s C++ ...
1
vote
1answer
228 views

Switching renderer off/on for an object in unity using C#

I have a GameObject called 'Stone' that is rendered on Game Play. I have attached a C# script called RenderOff to to make 'Stone' invisible on Game Play. RenderOff.cs using UnityEngine; using ...
0
votes
1answer
30 views

C# - console application, array problem [closed]

I have problem in very simple console app, code looks like this. int x - player moving and changing axis "x" and I want make full history of moving via array. See code(only example) below... Thank ...
2
votes
1answer
706 views

What is AABBvsAABB Collision detection?

Currently studying Game Engineering at university and my lecturer has asked us to implement a collision manager. He asks us to use AABBvsAABB to build it, so then we can add the physics. My question ...
0
votes
1answer
73 views

Implementing FSM on multiple class UNITY3D

I am recently implementing design patterns on my project, while researching around I came across many advance techniques like HFSM ,Behaviour trees. I did implemented behavior trees wherever required ...
1
vote
1answer
16 views

Monogame - stopping a custom shader (drawable game component) when inside another drawable game component [closed]

I have run into a bit of trouble when using a custom shader (gaussian effect) within another drawable game component, as I cant figure out how to break out of the draw method, so the effect is applied ...
0
votes
1answer
71 views

Understanding Unity 5 Car controller

As with all Unity versions Unity 5 comes with a set of Standard Assets. This new set of Standard Assets comes with a Car Controller. Either by attaching a Car user controller script or a Car A.I. ...
0
votes
0answers
7 views

Cannot get the specific bounds of my Animation sprite?

I have an animated sprite on my scene, and I would like to scale it to the screen width/height. So on my scene, I thought I'd add a Rect Transform first to find out my object's size, turns out it's ...
0
votes
2answers
66 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
1answer
30 views

Instantiate a prefab and call a method from it's script

I am creating a game in unity and I have a prefab that I instantiate on center occasions. What I want to do though is after instantiating the prefab. Get a handle to it and call a specific public ...
0
votes
1answer
38 views

how to stop camera at the end of world map when zoomed in

Im building a tile-based game, and Im trying to implement zooming in on the center of the screen. My problem is, when I get to the edge of the map and im zoomed in, Im noticing that my camera doesn't ...
0
votes
1answer
65 views

Draw many flashlights' focused lights' “circles” on a voxel engine map (and other objects)

So, I've been searching the internet for a while and I still didn't understand how to create a flashlight's "circle" in front of the camera over other objects. I found the following links: using ...
0
votes
1answer
28 views

Instantiated Prefab Facing Wrong Way

Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.)) I've been having a lot of ...
0
votes
2answers
33 views

Unity 5: Error when everything is okay(Object reference not set to an instance of an object)

i'm getting this error when the collider colides with something: Object reference not set to an instance of an object It's referencing to the gamecont.Death(); from this script: and the death ...
-1
votes
2answers
69 views

The Validity Of “Else-IF” in Unity (Or any C# for that matter) [closed]

While I'm speaking specifically for my use in Unity, I'm sure this question probably applies to C# in general. I've seen a lot of debate on the use of the "else if" statement. Particularly, I'm ...
1
vote
1answer
38 views

Finding flexible patterns in a 2D grid

I'm stumped trying to create a matching algorithm for my game. I have a 2D grid like this for example: 0, 0, 0, 0, 0, 0 0, 1, 2, 2, 1, 0 0, 1, 1, 0, 0, 0 0, 0, 2, 0, 1, 0 0, 0, 0, 2, 1, 0 0, 0, ...
1
vote
1answer
67 views

How can I keep AI from getting stuck on each other?

I'm currently working on AI and, as stated above, I'm having trouble figuring out how to keep the AI from getting stuck on each other. More specifically, I'm working on two different behaviors for ...
1
vote
1answer
44 views

Unity sprite with higher sorting layer not firing its OnMouseDown function

I have 2 objects, both have a Box collider 2D. The first object is on the Level1 Sorting Layer and has a Tile script attached to it. The second object is on the Level0 Sorting Layer and doesn't have ...
0
votes
1answer
23 views

XNA C# Texture Atlases

Fairly new to XNA and not an expert on C# either. So I was following a tutorial, specifically this one http://rbwhitaker.wikidot.com/texture-atlases-1, and there is a bit of code I am unfamiliar with. ...
0
votes
1answer
63 views

2D game world engine

I'am starting to develop a 2D game with snake or worm. My question now is: When my snake reaches the right edge the world should move. (Like in this game) My first thought was to implement a camera ...
0
votes
1answer
81 views

Pixel Shaders To Create Predator Effect

I am learning shaders, and I figured I would try to use them to create sort of a predator effect. I got to the point where I rendered my level to a rendertarget and passed that to the shader file, ...
2
votes
1answer
64 views

Speed needed to make a car jump from a ramp

I need to make a car jump from a ramp to another, and I need this to be done using AI so I thought it would be enough to set a fixed speed for my car when near the ramp, in order to let it jump ...
0
votes
0answers
33 views

How to make Unity3D Camera focusing on one area?

In my Unity3D project, I have a board created dynamically (using c#) and located on the screen as follow: 0 < x < 12 0 < z < 12 y = -1 How can I make the camera focusing on the board ...