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
0answers
2 views

Web Player build is not playing on web. Why?

I have been developing a web player game and after completing the build process in build settings I clicked on that build file then I found that the build was not playing on web and was showing some ...
3
votes
2answers
368 views

A* pathfinding for dynamic obstacles and player made blockages?

Hi I'm creating a TD in Unity 5 and need some help with my Pathfinding. I'm going to use Arons A* pathfinding for my AI which enables me to use dynamic objects and update the path during run-time. ...
0
votes
0answers
16 views

Camera rotation in maze game depending of accelerometer

I'm still newbie in Unity 3D... I'm trying to develop simple maze game. I want to roll my ball through maze, but I have to rotate camera left or right, otherwise the player can't see what's behind ...
-5
votes
1answer
29 views

How can I properly implement Lerp in this code so that the it can run smoothly in every device? [on hold]

How can I properly implement Lerp in this code? if (isJumping) { actualSpeed -= slowAmount * Time.deltaTime; transform.position += Vector3.Lerp (0.3f, actualSpeed * Time.deltaTime, 0); ...
1
vote
0answers
17 views

Why does interactive cloth not appear in game view in unity5 Pro?

I used interactive cloth fir flags in unity5 Pro version and it appears in scene view but does not appear in game view while playing. What can I do for that please somebody help me out?
-1
votes
1answer
29 views

Simple voxel-block melee removing script

I'm trying to create a voxel based game, now I want my character to remove blocks with a melee weapon, but I'm not sure which way to go. I mean is it the only way to get the Block with a raycast? I ...
0
votes
1answer
38 views

How do I use threads in unity c#? [on hold]

I have been developing a Web Player game in unity using c# but its not running smoother as I wanted. For that I took Unity5 Pro and then used profiler for optimizing the project but still not getting ...
0
votes
1answer
32 views

Why does my MonoGame mesh throw an unhandled exception when trying to draw?

I am using the '3D Models' chapter of Learning XNA 4.0 to further understand 3D implementation in XNA, but I am running into an unhandled exception, when I try to draw each mesh. Here is my basic ...
1
vote
2answers
39 views

How can I set up a delay before the rotation happens?

How can I set up a delay before the rotation happens? I tried StartCoroutine, yield WaitForSeconds .. But I failed.
2
votes
1answer
39 views

Getting the Volume of an Uneven Mesh

Let's say I have a cube, and that cube breaks apart into 100 different unevenly sized pieces. How can I get the volume of each of those pieces compared to the cube's volume? Using this in order to ...
2
votes
1answer
628 views

Creating a Static function inside my class to handle small housekeeping tasks

I have used Unity 3D for quite some time, and a lot of my game programming experience originates from using UnityEngine. Writing in XNA, I am setting up a nested list of objects. Each object will be ...
1
vote
1answer
41 views

How to Slice the external Spritesheet programmatically by using C# in Unity

I have a sprite sheet like this: I am using Unity Engine to develope my game. I would like to load this external spritesheet outside and slice it as Grid type programmatically instead of using ...
-2
votes
1answer
49 views

How can I make a gameObject “stick” to another gameObject after it has collided with it?

How can I make a gameObject "stick" to another gameObject after it has collided with it? Right now the gameObject just passes through! [C#]
0
votes
2answers
46 views

Unity - Determine direction vector3 from a point in space and an angle in eulers

I have a ball positioned as Vector3(x, x, x). I was able to get the direction of the ball to the mouse clicked position with: Code (csharp): Vector3 direction = Direction (clickPos2 - startPos); ...
0
votes
1answer
18 views

Unity Application.LoadLevel freezes the game on Android device

I'm developing a game using Unity. The game has a single level and after the player wins/loses, I simply want to reload the same scene. Here's the code I'm using: private void OnLevelFailed() { ...
0
votes
0answers
15 views

Use Lerp Position and Slerp Rotation together

This is what I try to do, When I click on a UI Element, the camera smoothly rotate (to look at the target) and simultaneously move on top of the target. To perform that I use a two Coroutine one for ...
0
votes
0answers
21 views

XNA4\ Monogame 3d Collision detection Help please

i have been trying to get 3d collision working for a while and i think(hope) you people can help me so for my project i have created a 'sprite3d' kinda class which is called ModelEntity and there ...
0
votes
1answer
22 views

How to make a in-game timer start with mouse movement in c#? [on hold]

This is my first time learning C#, I need to finish this for an upcoming school project. I have a basic "catch the cookies" game where cookies fall from the sky and the player catches them. I want to ...
1
vote
1answer
19 views

SDL.NET no longer detecting modifier keys

I'm using SDL.NET with C#. Recently, a bug has appeared where the library does not detect if the shift key is held down; although it used to do so. private static void KeyboardEventHandler(object ...
0
votes
0answers
38 views

XNA - Efficient way to get pixel color from rendertarget2D

I'm stuck with a framerate perf down with getData from a rendertarget, what's your idea, what are the other options I can use ? I explain my problem : I'm making a board game, the objects or monsters ...
0
votes
1answer
71 views

How to create 2D shadows and lightning?

How do I create shadows and lights in a 2D top down perspective game? I want to achieve an effect similar to this game (also made in unity) where some objects like a torch, different sprites and the ...
1
vote
2answers
50 views

How to display a list of 2D arrays in the inspector

Simply put, how do I make public List<bool[,]> appear in the inspector? Every 'bool[,]' is a solution to a puzzle in my game and I want to be able to view and edit them in the inspector.
0
votes
1answer
32 views

Determine facing direction mecanim 2d movement

I'm using this script to move my character in my 2d world: public float speed; //Movementspeed public Rigidbody2D rbody; Animator anim; void Start () { rbody = ...
0
votes
1answer
35 views

Unity5 How to create a floor

This may be a may be a very basic question but I have a 32x32 tile of grass for a 2D platformer I'm making. Is there an easy way to duplicate the tiles and lay them out? or will I have to copy and ...
1
vote
1answer
76 views

How to avoid lots of ugly math code and constants-hoarding?

In a lot of the games I've (tried) making in the past, I often run into the problem of the code getting really heavy on ugly mathematical code. This happens especially frequently in setting up ...
0
votes
1answer
28 views

Changing long float to number + short scale

I am looking to use a piece of code to take an extremely long number and convert it to decimal equivalent + short scale. (i.e. 120100000000 would be 120.1 Billion) I am doing this with two separate ...
0
votes
1answer
22 views

Delete EdgeCollider issue

In this program, When i draw a hill, a car can road on it's surface, and when I draw another one, the previous hill should remove. but unfortunately the previous edge collider looks still there. ...
1
vote
2answers
66 views

How can I make a gameObject jump quick at first then start slowing down after a while?

How can I make a gameObject jump quick at first then start slowing down after a while? It definitely has something to do with deltaTime.
-2
votes
0answers
27 views

Can someone translate the comments in this script to proper code? [closed]

Can someone translate the comments in this script to proper code? I want to detect a long press on a touch screen then activate an animation. When the finger is released, play another animation ...
0
votes
1answer
29 views

Unity tiles with wierd border flickering when moving horizontal 2D

I recently made some Tiles using a program called Pyxel Edit to create some placeholder graphics. The problem I'm having is that when I move the camera horizontal the edge of the tiles starts to ...
0
votes
1answer
30 views

How can I detect a long press then activate an animation?

How can I detect a long press on a touch screen then activate an animation? And when the finger is released, play another animation smoothly? Let's take for example the main character in Crossy Road: ...
1
vote
2answers
35 views

Create a 2D trail in Unity?

I would like to make a trail for a pixelated snake such as this one : As you can see, the cross simply repeats itself to create the snake. In Unity I have messed around with Trail Renderer, tried ...
1
vote
1answer
52 views

How do you know when you are ready for game programming? [closed]

I've been programming for a while now and I want to make games or game engines. But I don't really know how much of programming one does need to learn to have the proper knowledge to make games. My ...
0
votes
0answers
15 views

Is there a reason to create custom input for character controller in unity? [closed]

Is there a reason why I shouldn't use the cross platform inputs which comes with Unity( the ones in assets->import package Cross platform input). Some people told me that I shouldn't use them and ...
0
votes
1answer
21 views

(Unity) Drag and detect object below when dropping

I'm studying game development in Unity and I want to create a idle/clicker game like Cow Evolution. I'm using OnMouseDown, OnMouseDrag and OnMouseUp to move the GameObject around the scene. Now I ...
1
vote
1answer
50 views

Restricting body movement withing a specific length while dragging a gameobject in unity

private void OnMouseDrag() { Vector3 screen_sp=new Vector3(Input.mousePosition.x,Input.mousePosition.y,screen_space.z); Vector3 cur_pos=Camera.main.ScreenToWorldPoint(screen_sp)+offset; ...
2
votes
0answers
37 views

Monogame Startup Memory Spike

I am currently porting a game from WP7 using XNA to WP8.1 using MonoGame. I have been putting considerable effort into optimizing my game to be under the 185MB memory limit for low-memory phones. I ...
1
vote
2answers
30 views

Proper way to handle Movement/Animation/AI functions of an AI character in Unity3D

My team is currently building a 2D game in Unity and we've run into some workflow/script organization blockades for many of our game's characters. For example, we're not sure what the standard method ...
2
votes
0answers
53 views

Volumetric grass

I've been extremely interested in volumetric technology. Especially in volumetric grass. The online resources are extremely scarce on this topic. What is the difference from creating a lot of ...
1
vote
2answers
30 views

On key press, spawn a collider where my player is facing?

I'm trying to create an attack mechanic to my player hero in my 2D Tower Defense game. When I press the Q button I want my hero to do an animation and spawn a temporary collider shaped as a cone at ...
0
votes
1answer
31 views

Can't see instantiated UI element

I'm trying to create a level editor for a 2D game and I wanted to instantiate radio buttons, the backgrounds and numbers of which are determined by the tilesheet I load. I'm sure I'm doing something ...
0
votes
2answers
54 views

Generate static 2D Tilemap from array

How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.
-2
votes
1answer
65 views

Unity5 I lost my codes inside .cs file. C# files still exist, but codes gone

Unity 5.1.2f1 (64-bit) version.(windows 8.1) I closed Unity. After a while ago I opened Unity and I had some errors in Console.Then I clicked the error and I realized that I lost my code in some of my ...
1
vote
0answers
123 views

How should we begin to create our 2D Tower Defense? [closed]

Me and my friend are going to make a 2D Tower Defence game as our last assignment in highschool that has to be finished april/june next year. We both know a handy bit of Java and C# but our game is ...
0
votes
1answer
31 views

Collision in EdgeCollider Unity

I want to make a collider for a line that I've drawn on the screen using mouse. so the detection should be cover the whole line that has drawn. What I've learned from edge collider is you can have ...
4
votes
3answers
492 views

Unity 5 disabling a script

I'm using Unity 5 and want to disable a script called Unit based on whether the instance is a client or a server. I have tried using: GetComponent("Unit").enabled = false; However I get hit with ...
0
votes
1answer
24 views

GUI.DrawTexture problem in Unity

I'm having a problem with GUI.DrawTexture() and I'm looking an alternative function to draw 2D Texture Images. The problem I have is that my textures draw above all other objects and when my camera ...
-2
votes
1answer
47 views

I cannot move a gameObject in my scene

I am trying to move a cube to the right in my scene with this piece of code, but it does not work. What is the problem? using UnityEngine; using System.Collections; public class Jump : MonoBehaviour ...
0
votes
2answers
106 views

How to design programatically a game map like Risk?

I'm making a quiz-game based on map territories with a system similar to the Risk game (except there are no tanks but tickets). The map isn't the world but a custom map that I designed and I'll ...
0
votes
1answer
53 views

Monogame/XNA Making animations play once per click

I'm currently making a #gbjam entry and everything has been going smoothly up to this point. My issue being that I've implemented a shooting mechanic and along with it an animation to play as a shot ...