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

3
votes
2answers
22 views

Callback on Derived Class?

How does Unity3D implement their system where if a class is derived from MonoBehaviour and has certain methods like Awake() or Update(), they are called accordingly? I want to do a similar system for ...
2
votes
0answers
21 views

Unity C# - My parameter 'campfireNew' does not exist (SetTrigger)

I'm trying to set a SetTrigger parameter to call a different sprite animation on a campfire. I tried this also with a boolean, yet again the same error. parameter 'campfireNew' does not exist. Anyone ...
2
votes
1answer
66 views

Structure for attacking in RPG

I'm going over different ways to implement attacking in a "dungeon crawler". What I have kind of abstracted out... There are 2 kinds of people, The Player, and the enemies, these are both living ...
0
votes
0answers
36 views

Using collectable items to change a gameobject Unity

I’ve been working on a 2D platform side scroller. I’m rather new to Unity and C#. Basically what I’ve achieved so far is a character which can collect Logs throughout the game and those logs are ...
1
vote
0answers
24 views

How can I get the pressure of a touch in Unity?

Does anyone know how to get the getPressure function from the Android API into Unity? Or is there another way I can access the pressure of a touch?
1
vote
1answer
24 views

Change Tag of Instantiated Clone

In my game there is a bird flying up and a stream of containers (baskets) is moving from right to left of the screen in the bottom. Baskets are being Instantiated on right and get destroyed when they ...
2
votes
1answer
22 views

Unity - C# - Overlapping Rectangles not separating

I am Instantiating a lot of Rectangles of different sizes (ranging from 3 to 18 units) and they all have attached this script, which should cycle through all the GameObject List which contains them. ...
8
votes
3answers
936 views

Looking for some insight on programming design for attacking and attack types in a game

So, I'm starting to introduce attacking to our 2D space RTS (This is in Unity, so it's component driven). Initially it was as simple as "enemy in range, damage applied". However there will be multiple ...
0
votes
1answer
24 views

xna - Render background and multiple sprites to a single texture

I currently creating a game and I am trying to render my background and a sprite to a texture. Currently I have the background being rendered to a texture. But I am needing to render both my ...
3
votes
1answer
58 views

Why does glBindVertexArray sometimes fail (but mostly not)?

Quick outline: Test program that loads and displays big (3k x 4k) 16bit gray scale images (ca. 32MB). Using modern OpenGL (eg. 3.3 or so) with shaders VBOs VAOs etc. Running on Windows with OpenTK ...
1
vote
1answer
78 views

Unity - Basic AI Enemy Follows Player - Prevent Flocking Of Enemies Together

I'm in the process of implementing a 2D top-down shooter game. I have a basic AI script that allows enemies to follow the player around. Currently it works fine for one enemy, but as soon as there are ...
1
vote
1answer
37 views

How to add a UI Text for keeping Score in Unity 5

My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: ...
0
votes
1answer
40 views

Projectile Shoot three at a time

In my game there is a bird flying and on touch it throws different artifacts projectile downwards. And these artifacts should hit the containers moving right to left on the screen. Now if user keeps ...
0
votes
1answer
34 views

How to prevent constant adjustments form collision?

I'm try to clone a popular 2D platformer as a project. For both the player character and enemies, whenever I constantly check to see if they are walking on the ground or floating platforms, they ...
0
votes
1answer
54 views

how to Move Player on “Z” Axis 2D Movement

first im little new to unity..currently im working on 2D game mobile game.and im using Stranded Asset(Mobile) Single Joystick prefab to move Player..Currently my player move on X and Y axis. can any ...
0
votes
1answer
37 views

Input.mousePosition gives a NullReferenceException

I'm trying to Add raycast shooting to my player but when I get the Vector2 mouse position it give this error NullReferenceException: Object reference not set to an instance of an object This ...
0
votes
0answers
73 views

About Developing Games [on hold]

I am starting from scratch for a project to develop a game but I wanna start with just mind games like memory game that shows photos on grid and then disappears, something very easy as step one So I ...
-1
votes
1answer
38 views

C# Unity3D - How can I use a INT from other classes?

I have 3 Objects Capsule 1, Capsule 2 and Capsule 3. Every Capsule has a script on it for health/damage. It also contains an int for hits and points. Hits should be increased by one for every bullet ...
0
votes
2answers
31 views

After sometime increase the speed of Instantiated object

This may look similar to "increase speed after every N seconds" type question but it's different because objects are being Instantiated and getting destroyed. In my start() method I'm calling a ...
0
votes
0answers
17 views

Recommendation for C# .Net 4.5 Game/Graphics book/resource [on hold]

I'm looking for a book on learning graphics programming in C#. I asked this question in StackExchange, and they told me to go here. I hope this is the right section of the website family, as I don't ...
-1
votes
0answers
38 views

Call a method on many Objects in a List C# [on hold]

I've got a list called wheatTiles it contains many Wheat objects. The Wheat class got a update method. Im doing this to cal the update method at the moment : public void Update() { ...
2
votes
1answer
63 views

Stretch the game to fit the game window, in Unity 5

(Desktop) I want to make it so that when the user re-sizes the game window, the game is stretched to fill the window. (Similarly, for Android) I want it to be stretched to fit the screen as well. ...
2
votes
2answers
349 views

How do I save and restore an int value with PlayerPrefs?

I am stuck on how to save the player's amount of money. When I build the game in the exe as soon as I shutdown the game my money value gets lost. I want this money to be saved. I am using the ...
0
votes
2answers
47 views

C# Unity3D FPS apply damage to an enemy (Weapon bullet)

I am kindly new to Unity3d and c# and I don't understand how I could let a bullet deal damage to an other object. I've seen a lot of JS tutorials but no for C#. I've tried to use them, but it wont ...
0
votes
0answers
23 views

Exception with Lidgren on Mac OS X [on hold]

I was looking for a low level library for handling TCP/UDP sockets on the server for a long time. I came across Lidgren and I was thrilled - reliable and unreliable messages, sequences and unordered ...
-2
votes
1answer
33 views

Script to change size of a cube when pressing a button [on hold]

I am very new to coding and very bad at it. In my environnement there is a table, and i would like, after pressing a keyboard button, to make a cube appear. Then, by pressing another button, i would ...
0
votes
1answer
44 views

After collision of two objects change the sprite and move in its direction

I've searched a lot for this question but there was no answer that could solve the problem I'm having. I'm new to unity and a very naive developer.I'm making a game in unity using c# and it's like a ...
0
votes
1answer
42 views

Editing a new list of vector3's without changing the original list? (Unity) [on hold]

I just got Vectrosity for Unity and need to make a line of all the destinations for an object. Issue is that I need to use a single list of vector3's to create the line (as far as I'm aware). I have ...
0
votes
2answers
62 views

How to stop rotation every 90 degrees?

I was facing another rotation problem yesterday, that i managed to solve by rotating the object like this : transform.Rotate (speed * Time.deltaTime, 0, 0, Space.World); I tried almost every other ...
1
vote
1answer
59 views

Random, Infinite Terrain Generation [closed]

I'm trying to generate random terrain for my game (In Unity3D, C#). All I need is water and grass. No height to it (no mountains or hills.) I'd preferably like to do it by placing individual cubes. On ...
0
votes
2answers
33 views

unity2D Top-Dow Mobile rigibody2D

im using this code for my 2D TopDown mobile player movement.but when i move player With UI Image buttons player keep moving.it didnt stop.and also player starting of move he is very slow. the he ...
0
votes
1answer
49 views

Rotate Camera around GameObject in Unity [on hold]

Using Unity 5's new touch system, how can I rotate the camera around an object using touch detection, or "swipes"? I can do this using earlier versions of Unity, however the more recent version, Unity ...
0
votes
1answer
70 views

Delegation in unity C#

I have a game where I have balls bouncing and you shoot them. Since I need a way to end the level when the player shoots all the balls I though I would create a game controller script which will ...
0
votes
1answer
75 views

Unity 5 How Do I Set Text of Text Component of Input Field

How do I set the text of the new Input Field's Built In Text UI Object in Unity 5+? myInputFieldText.text = "Text Value I Want"; The code above does not work to set the text inside of a ...
1
vote
1answer
71 views

Tile Map Shader?

I'm trying to write a shader in unity that will take tiles from a sprite sheet and draw them onto a tile map. I'm new to shaders so this might be totally wrong, I think it might just be a math error ...
2
votes
1answer
133 views

How to correctly draw a line in Unity

I'm working on a game which requires me to draw a few lines from a single point that is more formally said Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates ...
1
vote
1answer
88 views

OpenGL: Draw an arrow

I'd like to know how to draw an arrow to represent a vector position, length and direction. The issue is that I can't quite find an easy way to know the location and rotation of the triangle ...
0
votes
0answers
44 views

.NET Unreal Tournament Bots [closed]

I want to develop AI bots in a 3D game environment using C#. There have been several initiatives to do just that within the Unreal Tournament engine. Unfortunately, none of these are maintained ...
1
vote
1answer
39 views

OpenGL why point's size stay the same while zooming/unzooming

i'm currently working on a game engine for a college's project. While implementing some debug tools I came across a little problem. When i'm drawing point on the ModelView Matrix the point's thickness ...
0
votes
0answers
47 views

How to get the position of a moving object

I need to get the position of the moving game object.But when I run the below code I always get the same position. public Vector3 position_store; void Update() { ...
1
vote
1answer
41 views

How can I refactor an enum so that it is still available in the inspector?

I am trying to use an enum so that it is available in the inspector. This code works: public ArmorTypeEnum ArmorType; public enum ArmorTypeEnum { Light, Medium, Heavy }; How can refactor it into a ...
1
vote
3answers
75 views

Learning To Use C# In Both VisualStudio And Unity's Monodevelop Frameworks

I apologize if this has been asked and answered, but I can't find it. I know the framework is different in MonoDevelop and Visual Studio 2010 Express. For instance, if I want to use Write.Line, I ...
0
votes
1answer
102 views

How to animate objects with bobbing up and down motion in Unity?

I have created a 2D platform game with Unity and C# where I have collectable items that can be picked up by the player. What I want is to give the items more focus by having them bobbing up and down. ...
1
vote
0answers
55 views

How do I Animate a character in Unity3D (Animator)?

first of all, I am new to Programming and Unity, but I want to create a simple game with Unity3D. I am using the StandardAssets (character) where all animations are included, but I dont get how to ...
0
votes
0answers
25 views

unity plugin for android (failed to receive dispatch signal error in logcat) [on hold]

i m trying to make a unity plugin for android. The plugin will show the native android dialog box when clicked on a button in unity. But when i click the button an error arises in the catlog and ...
0
votes
1answer
44 views

Fast mesh collision 3D (C# XNA)

I'm trying to write a simple program where a 3D landscape can be walked about with a basic camera. However, I've found it very difficult to do even simple collisions with my terrain. I'm wondering if ...
-1
votes
0answers
46 views

Game Server Framework [closed]

I already looked all over the internet, but couldn't find a straight up answer. I've developed a game for iOS devices with handling tcp/udp connections using the native library (NSStream). The only ...
0
votes
0answers
26 views

Unity3D Interactive Cloth Basketball Net Falling Apart Though Not Tearable

I have a basketball net mesh attached to an Interactive Cloth with the following attributes: The mesh is not segmented and is not marked as tearable but as soon as the game starts the net falls ...
1
vote
1answer
64 views

MonoGame 3.3 Font loading

Is there any way to have fonts in game without making a separate Content Project and adding a .spritefont file in the new 3.3 Monogame? You can now load other resources directly from the Content ...
0
votes
1answer
44 views

Create a continuous flight path on a Bezier Curve in Unity3d

I am working on a game in which a butterfly is flying along some path. What I am trying to do currently is create a Bezier curve starting from the butterfly's position(previous curves end point) and ...