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
3answers
128 views

Make object follow another object while keeping the same distance from it

I want an object to follow another object just like the way it follows it when it's parented to it, but smoothly and only in the x and z axis. Here's my code so far: distanceX = player.position.x - ...
1
vote
2answers
41 views

How to make a Sprite be displayed always behind everything else?

What I am in need to achieve is to have a Sprite always facing the camera identically to what happens with any simple game UI object, but instead of always displayed above everything else, it should ...
0
votes
0answers
11 views

HOw to load all “ *.extension ” file from specific folder in unity.?

I want to load my all file from folder of "* .dat" or ".txt files in list one by one. And If you can help then also tell me to make them all clickable with different event respectively.
0
votes
0answers
33 views

Defining camera/view space

Im working on expanding my camera class, but having trouble defining camera/view space in the manner of this diagram: What Im trying to achieve is to define the camera as a true object much like a ...
-2
votes
1answer
15 views

Unity3D: Entering a trigger disables a few bools for no reason

I'm trying to make it so when an object enters a collider with the tag "Down" a single boolean turns false, but the problem is that more than one booleans(canGoUp, canGoLeft, canGoRight) are turning ...
0
votes
2answers
43 views

Quaternion not giving correct value back. What am I doing wrong here?

Right so I made a quaternion and assigned it a value but it reports back the wrong value. Here is the relevant code... Quaternion LeftTurnLimit = Quaternion.identity; float test = 0.1f; ...
0
votes
2answers
54 views

Why can I not change a Sprite directly? [closed]

I am changing the Sprites on an array of Images. I could think of two ways to go about it. The first way being: var images = GetComponentsInChildren<Image>(); foreach(var image in images) { ...
0
votes
2answers
49 views

Collider Effeciency Question

I'm creating a game where hundreds of rockets with colliders attached are shooting at a player. Should I write my script where: 1: The player script reads the collision from hundreds of rocket ...
-3
votes
2answers
130 views

what is perfect manner to load scene and than player position.? unity 5.3

Here i have problem with scene and object position. My problem is position of object/player changed after load scene. I don`t know why this happens?. I have saved my object position with "playerprefs"....
0
votes
0answers
107 views

Unity UI Drag and Drop with conditionals

I have a nice UI drag and drop system (big thanks to quill18 and BoredMormon for their tutorials) and want to get some conditionals in it. I have 4 numbers (that are instantiated on the canvas) that I ...
0
votes
1answer
56 views

Unexpected Execution Order in Unity (uNet)

I made a little game in Unity. It works fine in the Editor. But if I run the build version I get a NullReferenceException. This problem does only appear if the build-version-client hosts the game. ...
-1
votes
2answers
137 views

Most Efficient Way to Store player stats/data in Unity C#?

I am looking at storing player data in Unity from a script that I'm writing in C# and I would like to get an opinion on the best way to store the player's stats/data about the player like hours played,...
0
votes
3answers
64 views

Unity method to get a vector, which is x seconds behind another moving vector (A bit like TrailRenderer)

I want a function, which lets me follow a vector with a bit offset or delay, like it's done in the TrailRenderer. I tried to achieve this with the Lerp function, but that didn't work for me like I ...
1
vote
1answer
45 views

How to make a temporary collision?

I have a key and door system working, the character(ball) picks up the key and when it is within the collider it sets the text("press E to open") on the screen to active so that they can open the door....
0
votes
1answer
35 views

Unity move canvas slightly with smartphone acceleration

I'm developing an AR-App with the Samsung-GearVR. To get a smooth UI, I thought about creating a UI, which is not completely fix, I thought it could be nice, when the UI is slightly behind my head ...
4
votes
1answer
143 views

Can I use xna tutorials to learn monogame?

Can I use xna tutorials to learn monogame? I can't find any good monogame tutorials but there are tons of xna tutorials available and from what I have seen they are pretty much the same thing.
0
votes
0answers
43 views

Using the perlin noise of unity efficiently?

I have a little problem with my perlin noise values. It is generating a voxel mesh, that is flat. Here is a picture that demonstrates what I mean: As you can see, the terrain lacks any ...
0
votes
0answers
22 views

Clip on model XNA

I'm currently doing my water plane system (with waves etc...). Actually, I have a heightmap with a waterplane on it; refraction and reflection working perfectly, but now I want to add objects. So ...
0
votes
0answers
61 views

Side-Collision for Breakout game where ball moves fast

So I've been trying to make a breakout clone, which is my first attempt at a graphical game, I ran into some problems, and was hoping that this community could help me. I've got most of the mechanics ...
0
votes
1answer
98 views

How to handle collision detection

So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that ...
0
votes
0answers
54 views

Making ships shoot bullets

I'm programming this in C# with Windows Forms and I want to know how to make my ship go from the top to the most it could go the left then go down one row and go to the right and so on until it ...
0
votes
1answer
119 views

Creating a Board Game Strictly Using Windows Forms

I'm working on my final project for a Software Design class, and we've been tasked with creating a board game, specifically Risk. Right now, the back-end game logic is functional, however I'm ...
-1
votes
2answers
57 views

How to pass the snake to pass through one side of the screen and come out the opposite side in c# game?? Help me :(

How do I code the left and right collision, and also tell me how I can set the collision of snake according to the form size. If i want to change or maximize the form, snake should collide with the ...
6
votes
3answers
240 views

Understanding Scriptable Objects

I am trying to understand the logic and functionality behind Scriptable Objects. I 've watched the provided video 2 times and I keep getting lost. I tried to follow the code as well but with no luck. ...
0
votes
1answer
223 views

Monogame - Sprite sheet animation

I have a sprite sheet that contains a character walk cycle, and I have made a player class that allows the player to move and cycle through the walk animation, however the animation only works whilst ...
0
votes
0answers
19 views

Calculating wheel spin for players over network

I am creating a game in unity 3d that uses google play's real time multiplayer service. The game has cars that drive around and I am trying to figure out how to apply a rotation to the opponents' cars....
0
votes
2answers
68 views

How do I reference one gameObject with script attached to other?

this is all in Unity 3D with C#. Thing is, I have attached a script to my player that should Destroy TreeGroup (as in forest) whenever I press 'Q' and Instantiate them when I press 'E'. Here is the ...
0
votes
1answer
797 views

What is the proper way to get input from the motion controllers touch pads?

I've been trying to figure out how to get the inputs from the touch pads on the motion controllers but have yet to find out how to do so. Initially I tried doing the following (as it was how I ...
0
votes
1answer
66 views

Stuck the ball in the board (pingpong game)

this game isn't completed yet, i've created the part where the ball hits the board, but there's problem in playing and that's the ball stucking in the board. For a better comprehension and ...
1
vote
0answers
62 views

Connecting to external computer with lidgren

I'm new to networking and thought i'd muck around a bit with lidgren before i start implementing it in my games, so i made a little client/server chat program that works fine on localhost and lan. I ...
0
votes
2answers
182 views

Flipping car animation with coroutine not functioning properly

I am creating a game in unity 3d that has to do with cars. If you double jump and you are holding the joystick in a certain direction then the car will flip that direction (360 degree flip). I am ...
0
votes
2answers
283 views

How to do moving Rorschach using Perlin noise in c# without shaders?

I want to be able to make a moving Rorschach using Perlin noise like in this question but I know nothing about shaders. Is there a way to do it in just c#?
0
votes
2answers
125 views

Smooth movement from point A to point B in a tile-based game

I'm currently very new to XNA, and I'm trying to get a grasp on movement. Currently, I have a function that checks for keypresses, and moves my character from point A to point B instantly: private ...
1
vote
2answers
72 views

Unity Teleport Script issue

I wrote this script quickly just for moving across my map for testing purposes. I created a prefab with this script on it and gave it the Destination GameObject which works fine, it teleports me as ...
0
votes
1answer
30 views

Wheels not facing right direction when car faces different directions

I am creating a real time multiplayer driving game in Unity. I am using google play's real time multiplayer service. I am having an issue where the wheels of the cars that are over the network are not ...
3
votes
2answers
93 views

How to access the currently touched instance of the Prefab?

I have a prefab which is instantiated in the Scene and what I am trying to do is to disable with a touch or timeCounter but sometimes it disables all the instances of the prefab and sometimes 2 or 3 ...
1
vote
1answer
77 views

Unity syntax highlighting with VSCode

I'm using VSCode, not VisualStudio for Unity scripting. VSCode has syntax highlighting for C#, which works fine, but all the Unity related stuff like Vector3 doesn't get any highlights. I know, that ...
-1
votes
2answers
43 views

What is the difference between getting a reference and creating a new instance of an object? [closed]

I asked a question a while ago and got an answer that I can either get a reference to the object or create a new one, like the below example: Example myExample = get some reference to the object/...
1
vote
2answers
57 views

Get world position of touch on objects

In my Unity3d game, I want to get the world position that was touched, when I touch a specific object, regardless of all objects that are in front of it. How would I do that, I only know Camera....
2
votes
3answers
98 views

Calculate average of arbitrary amount of quaternions (recursion)

Simply calculate the average for 2 Quaternions should work like follows right? : Quaternion.Lerp(rotationlist[0].transform.rotation, rotationlist[1].transform.rotation, 0.5f); And now I tried to ...
0
votes
1answer
70 views

How do I access variables using namespaces?

I've got a whole lot of scripts, none of them so far use namespaces. But as I get more and more scripts to deal with I thought it would be a wise idea to start using namespaces. I've never used them ...
1
vote
1answer
19 views

How to get the GameObject's LayerMask?

I am currently following Unity's 2D Roguelike tutorial. In that tutorial, I have Player, Enemy, and Wall Prefabs, which all belong to a Layer called BlockingLayer. The Player and Enemy Prefabs both ...
0
votes
0answers
28 views

How do I turn a vector map into a nav mesh?

I have the following path finding problem: I have a map that is described as a set of polygons that are traversable and need to somehow write path finding for the system. The current data is that the ...
0
votes
0answers
37 views

The problem with the movement of the serpent (snake game)

I am a beginner,Unfortunately, the snake's movement can not write I do not understand how to do it? Do you like the idea? note:In fact, I mean, flexibility is a must have when moving in different ...
4
votes
1answer
303 views

Set a 'chance to spawn' for each GameObject in an array

I have an array of gameObjects in a spawner. I want to randomly spawn these gameObjects based on a weighted chance. I want to be able to manually set in the Inspector a percentage chance that an ...
0
votes
1answer
73 views

Game crashes when sound is finished

I'm trying to code a simple audio playback test game (which will be used in my actual project), and everything works fine, except for the fact that after the audio has finished playing, the game will ...
0
votes
0answers
137 views

c# adding object collision to multiple objects

I'm trying to make a mario, platformer type game, and from following a tutorial, they've done the collision like this, but im wondering if there is a simpler way to it since I want to have collision ...
0
votes
0answers
17 views

Effect of merging sprite

I want to create the effect of merging of colours if they are overlapping. My game is a tile-based game. For all intents and purposes, lets consider a tile from (0,0) to (1,1) in the entire example. ...
0
votes
0answers
22 views

Unity Compute Resource Management

I have a n open ticket with unity about some code I have that uses the GPU to generate quads and passes them to an array on the cpu. The code in question is a little specific to my situation so I don'...
3
votes
2answers
72 views

Stopping 3D object in place

I am at 1.2 stage (moving the player) at Unity course "Roll-a-ball" and have question: I want to add feature that stops a player and sets his new position on 0, 0, 0. I can reset the position, but I ...