C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
0
votes
0answers
5 views
Unity3D position of 2D objects with size of Object
I'm making a 2D project in Unity3D.
I want to place an image in the right upper corner.
I've got this working, but ofcourse the image is falling of the screen for a part (and completely when I change ...
0
votes
0answers
10 views
(Unity C#) Rotating an object over time to a RaycastHit.point vector
I am trying to rotate a game object (a weapon) to point towards where the centre of the player camera is focused. I am raycasting forward from the centre of the camera (centreCast) and also from the ...
0
votes
1answer
14 views
VBO Performance issues
I'm making a 2D Tile based game in OpenTK at the moment. Performance was really bad (laggy and slow) with direct drawing, so I switched to VBOs. The performance hasn't changed, it might even be slower ...
0
votes
1answer
25 views
I need my timer to go up every 30 seconds
I wrote code for a jackpot to increase from one date to the next, and it works beautifully. The client wants the numbers to stay put for a while, and then increase.
This is the code:
if (...
0
votes
0answers
11 views
UI text in Unity with Google VR
I am trying to make a UI text in the left upper corner that shows wins and losses. However, it doesn't appear. I have tried to make it world space and drag the canvas so it becomes a child of the GVR ...
-1
votes
1answer
27 views
UnityEngine.Camera doesn't contain definition for “active”
So I'm just trying to create a simple script in C# which will allow me to switch between two cameras, named Camera1 and Camera2. But I have run into the error UnityEngine.Camera doesn't contain ...
0
votes
1answer
36 views
Storing wins and losses locally in Unity
I am writing here as I have made a game in Unity where I want to store how many wins/losses a player has. The way I am thinking to do it is by putting 2 counters; One for every time a player wins, and ...
0
votes
0answers
13 views
OpenTK Y is completely inverted
Hello I am using c# and OpenTK.
For some reason i have the map y inverted.
The map is supposed to be like this:
But OpenTK render like this
I have been trying to set x or y negative but it is not ...
-4
votes
0answers
27 views
ERROR : Null reference exception
I wanted to access two variables named "blocksleft" and "blocksLeft" declared in two different scripts named "LoadLevel_02" and "LoadWinMenu". So I grabbed them in the scriptnamed "DestroyBlue". But ...
0
votes
1answer
20 views
ERROR : Destroying assets is not permitted to avoid data loss
I want my gameObject named lvl_01 to destroy when I click left or right arrow key but it's keep showing this error "Destroying assets is not permitted to avoid data loss" instead of destroying that ...
0
votes
1answer
26 views
show hide button in unity using c#
I have 15 buttons on my screen at onClick event am fetching the button and hiding that button using
EventSystem.current.currentSelectedGameObject.SetActive(false);
now at the end i have to show ...
0
votes
1answer
35 views
NullReferenceException in StartCoroutine method
Maybe it's a repeated subject in the community but other answers didn't solved my question...
I tried as the tutorial: http://answers.unity3d.com/questions/11021/how-can-i-send-and-receive-data-to-...
0
votes
2answers
49 views
A* movement implementation not working properly
I'm working on a RTS project and I'd like to use the A* Project by Aron Granberg to navigate around obstacles, etc.
The problem is that the correct path is displayed in the scene, but the unit just ...
0
votes
3answers
60 views
Rotating camera based on player's rotation
I'm trying to have a camera rotate mirror the player's rotation, however, this isn't happening and the camera isn't rotating at all. Can anyone explain what I'm doing wrong and how to fix it?
public ...
4
votes
1answer
316 views
Using Threads to create GameObjects
I have this game client which connects to the server and sends requests and getting responses.
I have created a separate thread for listening to the server. Based on the response from the server, I ...
1
vote
2answers
44 views
Load the prefab in the array by name in Unity
I'm using this line of code to select my level, and currently I have different scenes for each levels. I want to be able to reuse the same scene to change levels as well but I don't know how, here's ...
-1
votes
2answers
45 views
ERROR: MissingComponentException
I want my gameObject to play an audio clip when it collides with other gameObjects. So I attached a script named "ImpactSound" with it, but it's keep showing MissingComponentException: There is no "...
0
votes
0answers
37 views
Unity Endless Runner Restart Scene
I just created an endless runner. Everything works fine on Unity, but when I play on iOS and Android, when I press the restart button from canvas, after 3-4 times when restart was pressed, the game ...
0
votes
2answers
26 views
How do I find an accurate current speed of a navmesh agent?
So I have a blendtree of an idle/walk/run animation of a character (the navmesh agent). I want to use a normalised float of the speed of the navmesh agent to control the blend of the animation cycles. ...
-1
votes
1answer
43 views
System.Drawing.dll not found
I am creating an asset, in Unity, and I need to use System.Drawing. I have been trying to figure out how to add the DLL in a way that works, but I have had zero luck. I have tried adding the DLL to ...
0
votes
2answers
60 views
Null reference exception error
I want my gameObject 'spawned' to divert in the direction of vector divert when it collides with the GameObject with which this script is attached, but it keeps showing null reference exception every ...
0
votes
0answers
60 views
Shoot diagonally with Unity 2D
I'm working on a shoot script where the player can shoot right, left and to diagonal directions like right up and right down.
All of this I can make, the player shooting to left, right and right up ...
0
votes
0answers
30 views
Getting my 2D follower to double jump :L
Ok so here is the current situation, I am essentially trying to get my player's follower to double jump after he jumped. I've successfully got my follower to jump at edges but not so much for double ...
0
votes
1answer
21 views
How can I change the highlighted color of a Unity button when it's clicked?
I was playing around with buttons in Unity, and I wanted to see if I could change a button's highlighted color every time I clicked on it. I added a script in the same GameObject as a button component,...
0
votes
3answers
75 views
C# Monogame Enemy shooting at random intervals
I am currently coding a simple Monogame Space Shooter.
I have almost finished my enemy shooting behaviour,
but I spent a long time on fixing it and got to the point
where I wanted somebody to help me ...
7
votes
1answer
307 views
Unity JS to C# conversion - Incomplete list of public variables in Inspector
I'm trying to convert a javascript file to a C# script for Unity, mostly because the rest of my workflow is in C#, and I'm much more comfortable with C#. In this case, it's an audio controller script....
0
votes
0answers
33 views
Predict object position
The intention of this code segment is to predict the location of an object based on it's forward velocity and angular velocity. However, the position is not show where it's supposed to be; first when ...
1
vote
2answers
38 views
How to save a text file to relative Path
I'm creating an app that should be accessable from every platform (android, IOS, windows).
At this moment I'm saving a file that is set to a specific path.
c:\test\test.exe. Now I know that Android ...
0
votes
1answer
35 views
How to use JWT in unity
Is it possible to use JWT in my unity games?
I've read here that JWT needs .NET version 3.5+ and in Unity 5.4.1f1 the .NET version is "2.0.50727.1433". Is this information correct or incorrect?
If ...
0
votes
0answers
40 views
How do i change something so i can code in SharpDevelop? [closed]
I just picked up a new game engine called Duality. I'm also very new to coding so bare with me. i was practicing inside sharpdevelop and made a small game with console. Now im wanting to make a small ...
0
votes
0answers
13 views
Unknown rotation behaviour of gameObject while trying to rotate using LocalEulerAngles
I am new to game development , I am following a book Unity in action by Manning . This is the code snippet used to rotate a game object (from the book):
public RotationAxes axes = RotationAxes....
0
votes
0answers
7 views
Manual Audio Listener Read
Is there anyway to manually read an audio sample with the Audio Listener asynchronously to the normal unity workflow like you can do in Camera.Render()?
0
votes
2answers
57 views
Problem with shooting
So what I am trying to achieve is have the player shoot toward the mouse positiion and I have that working but I want the player to have to charge their shot. So if the player just presses the button ...
0
votes
1answer
18 views
Unity3D 5.5b : C# WebGL open email client Win32 exception error
I want to send an email in a WebGL build using C#. My code is as below
try
{
Uri myUri = new Uri("mailto:[email protected]? Subject=Hello%20again&body=TEST");
System.Diagnostics....
1
vote
1answer
36 views
C# XNA colliders, physics, inclined plane/terrain/colliders
Currently I'm working on a project to learn game programming. But I'm not sure if I have the right approach on several things, and that's what I'm here for.
What I'm trying to create is a small world ...
0
votes
0answers
40 views
How to create a simple axle in Unity?
Having trouble creating a simple car in Unity. I've tried wheelcolliders, but they give me a lot more than I need, and I don't like how they feel and don't perform very well. I've tried hinge joints, ...
0
votes
1answer
57 views
Snake game - Snake Collision
So I am making a snake game as final assignment for semester 1 of my game dev study.
We have to write it in C# in Visual Studio 2015. I am using the .NET 3.5 framework.
So basically how my snake ...
0
votes
1answer
85 views
C# What is the advantage of using interfaces for simulating multiple inheritance? [closed]
Interfaces are a feature of C# that I've never quite been able to see the purpose of. I see them used all the time in professional code, but for the life of me I can't work out the reasoning.
My ...
1
vote
3answers
75 views
Stopping player from spamming movement keys which causes glitches Unity C#
I wrote a script for the player movement in c#. Whenever the player presses A or D, it moves him/her to the left or right by 12 units and when the player presses W or S, it moves him/her up or down by ...
0
votes
0answers
34 views
Apparently Bizarre Behaviour of Instantiate() and if()
To begin, let me note that I have scoured this website for answers that may speak to my situation and have not found any that immediately satisfy my curiosity. In a very basic game, I have written a ...
0
votes
0answers
20 views
monogame - how do I distribute a lib / package with content?
I wrote a UI lib for a monogame hobby project I'm working on, and I want to distribute the UI code / lib as open source for others to enjoy.
My question is - what do I do with all the content that ...
0
votes
0answers
26 views
Unity AddForce Movement Issue
Trying to fine tune my player movement, currently move the player in x and z directions using AddRelativeForce so W key moves you forward the local direction not in global direction, works mostly ...
4
votes
2answers
302 views
Replicating Flight Mechanics of Star Wars Battlefront (2015)
I'm trying to replicate the flight mechanics from Star Wars Battlefront (2015) in Unity and I can't get my head around what exactly is going on.
Specifically, how do I get the camera to behave like ...
0
votes
2answers
54 views
Identify whether object is off screen or not
I have placed three game object in the scene.How to know whether the object is visible on the screen.Print a message if the object is not visible on the screen.
-1
votes
1answer
55 views
Smoothly moving an object sideways by a certain amount when a key is pressed Unity C#
I basically want to have the user press A once without holding it down, to smoothly move the player to the left. I would like to make the player move to the left by -12. So he would end up going from ...
0
votes
1answer
27 views
Player object glitching around when there is a low framerate Unity C#
I just started to make this game, it runs fine on my computer. 60fps, but when I tested it on another computer, with lower fps, the player just started to jitter and glitch around a lot. The game is ...
0
votes
2answers
50 views
Input.GetKeyDown need to press button more than once to work
So in Unity3D I'm checking for Input.GetKeyDown(KeyCode.E) for stuff like pickups and opening doors. Sometimes it doesn't work the first time I press it and I must press the key E like 2-4 times, and ...
0
votes
1answer
35 views
Trapping Asserts in Visual Studio
I'm writing a 2D game with some fairly complex off-screen logic, with plenty of room for bugs. My usual habit is to write code with a lot of Asserts in it. When an Assert gets hit I drop into the ...
0
votes
0answers
41 views
Drawing Pixels to Texture
I have some bitmaps for grass and snowy grass. I am using them for a tiled based map and for a little experimental weather scene.
The current state is that I always need to create a new Bitmap for ...
0
votes
2answers
49 views
Unity Failed to Repackage Resources
I was trying to integrate Admob into my unity game. I imported the Google Play Games plugin and the Admob Plugin , but I have been getting this error for the past couple days.
...