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

In Unity3D, what ways can I improve the batching with a single texture atlas and four-point material?

I'm building a randomized city terrain with a set of planes, custom 4 vertice square made in Blender. I've got a texture atlas working so that it draws on a single material and texture, but it's still ...
0
votes
1answer
21 views

Shmup Unity, create an enemy spread shot to the player

Following this lecture: http://www.shmup-dev.com/forum/viewtopic.php?f=6&t=347 , i created a bullet that shoot from the enemy directly to the player, in a straight line. Now i want to create 3 ...
0
votes
0answers
7 views

Unity: Set Zoom's Center XYZ point

I have my pivot/orbit camera set up: http://pastebin.com/2c7buUjV When I zoom in/out it snaps to the center of the sphere, then starts the zoom. I want it to zoom from where the camera currently is. ...
0
votes
1answer
55 views

Tower defense game structure? [on hold]

I've made a simple Tower Defense game in Unity with C# scripts. Currently it only has a working Tower and some minions walking by a path to the players base, but eventually I going to add more towers ...
0
votes
0answers
21 views

Unity: Set X,Y,Z default position of camera [on hold]

I'm trying to set the default value of the camera. I want it to be 5,5,-10. using UnityEngine; using System.Collections; public class OrbitCam : MonoBehaviour { //The target of the camera. The ...
1
vote
0answers
11 views

Picking up objects and dropping object in untiy2d [on hold]

I want to add a functionality to make the player able to pick up certain objects and dropping them. When the player move towards the object he wants to pick up,when he picks up the object and move ...
0
votes
0answers
25 views

Need help with understanding how methods work and various other progamming noob problems [on hold]

So I'm currently working on a very small project - just a game based off of some of the things I've learned from unity tutorials. In the GameController script I have a method called GameOver that's ...
0
votes
0answers
20 views

Character Controler for platformer [on hold]

I need a code for a character controller, for a side scroller game, and i cant find any. Im working in unity and pref not to use theirs.
0
votes
0answers
30 views

Unity material is missing after compilation

I have a piece of code that signals the player that a projectile has hit its target. Everything works fine during the playmode, however after I compile it, it acts as if there was a missing material. ...
1
vote
0answers
43 views

Create an 2d Isometric map with tiles?

I'm creating a 2D Tower Defense game and I want it to be isometric. I'm creating it on the XZ plane in Unity(3D mode). I need the map to be based on tiles so I can seperate the monsters' path and the ...
0
votes
1answer
38 views

Instantiating on a random node, provided the node is walkable, but what if it isn't walkable?

In my demo I have a GUI where the user determines the number of AI that will spawn. I would like these AI to spawn onto the walkable area of my Grid. So I choose a random position then get the node ...
0
votes
0answers
18 views

How to build Isometric tiled-based TD map [on hold]

I'm planning to create a 2D isometric Tower Defense game in Unity3D. I want to make it tile-based so I can split the tiles and give them different functions, ex I want the player to create different ...
0
votes
0answers
19 views

Creating a custom collider shape in unity, and performance concerns

I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want ...
0
votes
1answer
38 views

Make my Tower continously fire at enemy while inside collider?

So I've made a Tower script in c# that spawns a projectile that then fires at the enemy gameobject. However, because I'm using the OnTriggerEnter() function it will only fire as many times as ...
0
votes
1answer
29 views

Is transform.forward mutable?

Suppose I have a GameObject, and I want it's transform.forward to be facing up. Is it possible to change it as seen below? public class Main : MonoBehaviour { void Start () { Vector3 ...
0
votes
1answer
31 views

Unity Character jumping to the direction of the key pressed and not moving in any other until grounded [on hold]

I've been trying to figure this out for about 3 hours now, I have a first person controller script based on the Unity Standard Assets one and I'm trying to figure out how to jump to the direction of ...
0
votes
2answers
40 views

Character on spherical terrain

My game is played on a big spherical world. Made up of a big spherical mesh with sphere collider, with 'gravity' at it's center (gravity for objects is controlled trough scripts). Now if I put a ball ...
0
votes
2answers
58 views

(Efficiently) Generate Unique Random Numbers [duplicate]

Sorry my terminology is somewhat limited so I'll have to use more words to explain what I mean. In games that require critical hits, I've heard it's not good to generate a random number but instead ...
0
votes
1answer
31 views

StopCoroutine is not stopping my coroutine in Unity

I'm getting some attacking to work with my units and I noticed that the coroutines seem to start adding up even after the StopCoroutine(IEnumerator) as need called. I dug around on ways to perform ...
1
vote
0answers
22 views

Unity - C# - Angle tile not instantiating [on hold]

I'm currently connecting two rectangles with a 'L' shaped line. I have written the code so that it cycles for every position from one rectangle to the other and instantiates some gameObjects that ...
3
votes
5answers
96 views

How to “merge” multiple intersecting circles so that only the outer edges of each show?

In my RTS (In Unity) each unit or building has strategic circles in a similar fashion to SupCom. If you have multiple units or buildings selected it looks like the picture to the left. I want to make ...
1
vote
0answers
61 views

Recursive backtracking sometimes missing a tile?

I have a basic recursive backtracking alghorithm for a maze. It pretty much works but ocasionally leaves some tiles in the corners untouched. This is the recursive function: void ...
-1
votes
1answer
34 views

'The thing you want to instantiate is null' - unity error when instantiating

I have a Game Object called 'car' in my Assets folder. I have this code in C# unity to instantiate it. GameObject car; void Start () { Vector3 position = new Vector3(5, 5, 5); ...
0
votes
2answers
44 views

Instantiate a prefab on unity and make it appear at a specified coordinate

I have a prefab called 'road'. How can I instantiate it using C# script so that the instantiated object appears at coordinate (5,5,5) ?
4
votes
2answers
225 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
1answer
96 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 ...
3
votes
1answer
96 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
1answer
88 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
42 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?
2
votes
1answer
31 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 ...
3
votes
1answer
32 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. ...
11
votes
3answers
1k 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
30 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
63 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
102 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
84 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
44 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
36 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
64 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
38 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
75 views

About Developing Games [closed]

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
39 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
55 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
18 views

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

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

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

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
70 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
363 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
54 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
26 views

Exception with Lidgren on Mac OS X [closed]

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

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 ...