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

How to make a stab function?

I've looked around everywhere, and I can't find an example script for a stab. What I have so far is a top down 2D scene, with a player at the bottom (static). I would like to have the sword/tongue to ...
0
votes
0answers
23 views

How to rotate an object on a rectangular circle shaped track in unity5?

Actually I have 10 objects and these all are automatically run on playing game as its a betting game which is going to play on browser but I don't know that how to rotate that objects on curve on a ...
0
votes
0answers
18 views

LibNoise Perlin.GetValue not returning noise for zero decimal place numbers

I'm using the LibNoise port from C++ to C# and running into problems generating Perlin noise (Unity demo here). For some odd reason integers never generate any noise. In the code below _firstValue on ...
-4
votes
0answers
25 views

How do I change the control from PC to Mobile? [on hold]

I have my character control script working on the pc. How do I change this script to work for a mobile port? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { ...
0
votes
1answer
40 views

Getting path of right click in unity 3D editor

I want to create an extension for the Unity 3D Editor and have an custom asset type. During the process of creation this I recognized that I would improve the UX/usability if I can specify the path ...
0
votes
1answer
17 views

Unity - custom Export and Import FBX Data

I am trying to write custom data inside a FBX file from 3dsmax at export time. This might be possible even if I don't know right now how to do that. But my question would be how can I read those ...
0
votes
1answer
29 views

How to create axes for a console controller

What should I change in the input manager to enable me to use a joystick? I have a usb cable to connect the joystick to the computer but how do I set up the controls?
0
votes
0answers
15 views

How do I save and perform the commands at client side in unity5? [on hold]

I have been scripting for a web player game for that server sends few commands to client machine But I don't know how to save and perform the operations as per the commands. If anyone knows please ...
0
votes
1answer
46 views

Can't set up a PS3 controller in Unity

So I connected a ps3 controller to my computer via USB cable, when I press play I am able to move by using arrows on the left of the ps3 controller and also I am able to shoot and aim by triangle and ...
0
votes
1answer
39 views

How to correctly draw a 2D polygon in Unity

I'm trying to draw a 2D polygon using GL.Line; however I'm not getting a polygon but separated lines instead. In the example below, I would expect a rectangle formed by the spheres: My code is the ...
1
vote
1answer
51 views

How can I accurately simulate orbits in Unity?

I would like to create a space simulation with realistic gravity. This means planets in 3d space which act as central gravity sources and multiple objects which are attracted by those planets gravity ...
0
votes
0answers
16 views

How do I handle or manage commands which are sent by server in unity?

In my game there are 10 objects which are just started running on play as this is a web player game and betting as well and it requires some socket programming. At run time the commands are sent by ...
1
vote
0answers
20 views

SoundEffect.Play and SoundEffectInstance.Play do not work

I am having issues playing a music file in MonoGame. The problem is, an old version worked fine, but I lost it to corruption. Basically, I create an instance, call instance.Play, and hear nothing. I ...
1
vote
1answer
35 views

My intersect detector isn't working

I'm trying to create rooms dinamically by creating them in random places and checking if they do overlap each other. The idea is that if the new room intersects with another one, it must be recreated ...
0
votes
0answers
14 views

Need help with torque and velocity [closed]

I made some basic movement code for my player in C#. Here it is: public class Movement : MonoBehaviour { public float rotationspeed = 100.0f; public float maxrot; void Update () { ...
1
vote
1answer
37 views

Using coroutines to instantiate larger GameObjects in Unity/C#

We are making a scroller type game for mobile platforms and we got pretty far (Beta is already out). Now we are adding some additional content and are starting to experience a noticable lag when ...
0
votes
0answers
13 views

Web Player build is not playing on web. Why? [closed]

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 ...
6
votes
2answers
558 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
20 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
36 views

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

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
21 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
40 views

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

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
2answers
37 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 ...
0
votes
0answers
10 views

Monogame and winforms - drag and drop images

So I managed to create the form design of my level editor and I embedded Monogame in it using the GraphicsDevice sample. Then I used the PrimitiveBatch sample to draw a black grid 32x32 pixels. Here's ...
1
vote
2answers
40 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
41 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
644 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
50 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
48 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
26 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
19 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
24 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#? [closed]

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
20 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
41 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
72 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
56 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
33 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
85 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.
0
votes
1answer
35 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
32 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
39 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
55 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
1answer
26 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 ...