As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [unity]

Unity is a cross-platform game creation system that focuses on easy art pipeline process. It consists of a game engine and an integrated development environment. The game engine's scripting is built on Mono.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
1k views

Why is my coroutines not working with in the if statement?

Isn't it possible to start co-routines under certain conditions? Or, it should only be started at the initial steps only? There is an enemy which will be de-activated after certain condition which ...
Yo Ko Hola's user avatar
-2 votes
1 answer
48 views

How many unity version support with 1 seat?

I bought plus unity license 1 seat so Can I use it on 2 unity version Example: Uity5.3.4p3 and unity 20183.18f1 Or it use only for one version?
siavash's user avatar
  • 31
-2 votes
1 answer
207 views

How to make a person walk within a Unity scene? [closed]

I have a person in my Unity scene. My person follows waypoints and move. However, the movement is very unrealistic, the person seems to be floating through the scene rather than walking. How to make a ...
D.g's user avatar
  • 329
-2 votes
1 answer
384 views

How to move a 2D boat in unity

I am working on a 2D game in which boat moves continuously but the direction of the boat is on users touch. Where the user moves its finger the boat moves in that direction. How would I achieve this? ...
Uzair Mughal's user avatar
-2 votes
1 answer
448 views

How Can I Roll A Cube In Unity?

Roll a cube in 1 direction Hi, I want to move a cube just to the front when the screen is taped in my Unity 2D project. I have seen some codes about this but I just need to move it in one direction (...
user10281361's user avatar
-2 votes
1 answer
107 views

make the ball stick to the path

Hi guys , I want the ball to stick to the path and whenever it find a corner like in the image it continue normally without flying away .
Si Lawas's user avatar
-2 votes
1 answer
5k views

RenderTexture.Create failed in Unity. please help me

RenderTexture.Create failed: width & height must be larger than 0 UnityEngine.RenderTexture:Create() Prime31.SpriteLightKit:updateTexture(Boolean) (at Assets/SpriteLightKit/SpriteLightKit-master/...
The Billionaires's user avatar
-2 votes
2 answers
2k views

Unity 2d how to stop infinite jump

So my problem is very common but as far I am able to find tutorial on how to stop game object to do infinite jump is make a bool then set if y velocity == 0 then set bool to true else its false but ...
Kartik's user avatar
  • 139
-2 votes
1 answer
2k views

Android Phone Back Button not working Unity

I take an empty gameobject and a script in which I just write below code to handle back button in android phone, but it's not working. ...
Rupal Patel's user avatar
-2 votes
1 answer
65 views

Enemy (prefab) Behaviour messed up

I have created a prefab of an enemy with a NPC Behaviour script attached to it. The enemy correctly detects the player's position and walks (with animation) towards it (NavMesh Agent). If in range the ...
Valamorde's user avatar
  • 417
-2 votes
1 answer
1k views

Unity - Progress bar with sprites

I have 4 images that I made in photoshop that represent the progress the player is making in the game. When you finish the first level the image changes, when you finish the second level changes again,...
detdimples's user avatar
-2 votes
2 answers
2k views

Play a sound when moving cursor on a button?

How to play a sound when moving a cursor on a button ?
user43474's user avatar
  • 537
-2 votes
1 answer
751 views

Stacking cubes on top of each other [closed]

How can I stack cubes on top of each other? I dont want to know the code of it just how can it be done? Imaging putting cubes on top of each other in a 3d world with the cube being freely moved in all ...
user108843's user avatar
-2 votes
1 answer
418 views

'NullReferenceException: Object reference not set to an instance of an object' when similar code works

I am getting an error when accessing a function from VirtualRotationStick, despite the fact that a similar VirtualJoystick works ...
bertie.io's user avatar
-2 votes
1 answer
3k views

Record voice and play in unity?

i wanted to ask that does unity3d support audio record and playback option and if it does, how is it possible to just speak and the application will record the sound and play it back after a little ...
Chetan's user avatar
  • 37
-2 votes
1 answer
41 views

Random copies of an object?

If I press C<\kbd>, several copies of a prefab show up in the scene. However, my script only creates one. I need to make a random copies, like between 1 to 5. How do I do this? ...
user43474's user avatar
  • 537
-2 votes
1 answer
10k views

How do I load scene using scene manager build index in the build setting unity3d

I only got one scene to load when the timer reaches zero; I need one more scene to load. The scene manager builder index is not working for me. I have tried ...
Zacheus PaperChaser's user avatar
-2 votes
2 answers
7k views

How solve 400 Bad Request error in unity? [closed]

400 Bad Request UnityEngine.Debug:Log(Object) FBScript:DisplayUserName(IResult) (at Assets/Script/FBScript.cs:63) Facebook.Unity.c__Iterator1:MoveNext() (at Assets/FacebookSDK/SDK/Scripts/Utils/...
Chetan's user avatar
  • 37
-2 votes
1 answer
79 views

How to make my "first person controller" continue to turn left or right when key is pressed in Unity 5?

I recently posted this How To Make My First Person Controller turn left and right in unity 5 but now I'm having a slight problem when I press the key that turns my camera it only does it for a little ...
sketcherskt's user avatar
-2 votes
2 answers
327 views

Publishing a Unity game to Android/iPhone

How can I publish a game that I made in Unity onto Android and iPhone? How do I generate the Android/iPhone binaries?
user76494's user avatar
-2 votes
1 answer
101 views

Where to put the script? [closed]

I watch this video https://www.youtube.com/watch?v=Uhnh8zj_VPo and my question is where to put the script? I'm a complete noob here but I've at least build a map and moving player character. Yes, ...
Rei's user avatar
  • 11
-2 votes
2 answers
212 views

FixedJoint error in Unity?

I get the following error every time I run the code: error CS0120: An object reference is required to access non-static member `UnityEngine.Joint.breakForce' ...
That's me.'s user avatar
-2 votes
1 answer
211 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 ...
Enes Kaya Öcal's user avatar
-2 votes
1 answer
908 views

How do I have a player also be a server? [Unity 2d]

I'm trying to make a game in Unity 2D, and I need a player to be a host because I can't afford dedicated hosting. Each client will have files that the server (and other clients) need to be able to ...
Daniel Paczuski Bak's user avatar
-2 votes
2 answers
6k views

In Unity, how do I make the camera follow a character?

When my character moves, I want the camera to follow them, such that the character always stays in the middle of the view. How do I do that in Unity? Here's my code right now: ...
Ali's user avatar
  • 1
-2 votes
1 answer
798 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 ...
kel's user avatar
  • 7
-2 votes
1 answer
329 views

Joystick control for camera only works when button pressed

I'm trying to use a controller that has a joystick. I'd like to move the camera when the player moves the joystick. The joystick also has a button. So far I'm only seeing the camera move when the ...
Elior's user avatar
  • 149
-2 votes
1 answer
1k views

if statement is executed even when condition is false [closed]

I've made some code that is triggered when the player is in range of the enemy. Everything was working fine until I tried to implement a condition when the countdown reached zero. I made a method (...
OwenAlexander's user avatar
-2 votes
1 answer
3k views

How to make healthbar decrease in unity [duplicate]

I want to build a health bar which show's the energy of the player.I have two buttons "PLAY" and "IDLE" to show the animation.when I click on the "PLAY" button the character start running along with ...
user1509674's user avatar
-2 votes
1 answer
941 views

Energy Bar in Unity [closed]

I want to display a debug message when the progress bar is loaded fully and I have a button "refresh", when I click this it should reload the progress bar. Here is the code I have tried: ...
user1509674's user avatar
-2 votes
1 answer
472 views

How to know the relative facing angles between two players? [closed]

I want a grappling system similar to Tekken, in which different grapples animations are performed depending on which side of the opponent the player performing the grapple is facing. For example, ...
user42164's user avatar
-2 votes
1 answer
1k views

Lerp speed or lerp time [closed]

Am I right about the fact that lerping can be done over a set period of time or at a speed which will continue until the target is reached? How are the formulas for the two? Is it something like ...
Daarwin's user avatar
  • 829
-2 votes
1 answer
258 views

How to keep a GameObject from dropping?

I am applying the following script to first person object: ...
gitright's user avatar
-2 votes
2 answers
246 views

UnityScript generating UnityEngine error

I have the following code set out for a simple animation in Unity: ...
Paul Ferris's user avatar
-2 votes
0 answers
30 views

How to replicate leaping slinky motion?

I want to replicate the movement of the spring-like stack of rings in this game (Smash Race): How can I create this kind of movement in Unity?
Ajeet Prajapat's user avatar
-2 votes
3 answers
2k views

How to detect objects within a radius without using a trigger collider?

I want an object to run code that detects objects around them, in a specific radius. BUT I cannot use a trigger... or any game objects or components on the objects I'm trying to detect. What could I ...
Ryan Johnson's user avatar
-2 votes
1 answer
1k views

How to make random spawn objects in unity 3D

I created an infinte runner game. I need to make random spawning obstacles ON 3D. How do I randomly spawn prefabs on the X axis using a C# script?
Саша Ростягай's user avatar
-2 votes
1 answer
471 views

Instantiate prefab on specified position of GameObject on scene

I have a room that I want to connect to a staircase. Both the room and the stairs have the following parameters: I need to "magnet" the "Room Exit" position of the room (start ...
ArtemiZ Studio's user avatar
-2 votes
1 answer
41 views

Error cs1061 Is Showing Up [closed]

I've been looking into this online but can only find similar cases that don't really match mine and because of that I'm having a little trouble finding a clear answer to how to fix this code. Please ...
Wolf Bot's user avatar
-2 votes
1 answer
604 views

Moving a 2D object up & down y axis within certain limits

This was originally written to move a 2D object along the negative x axis. Now I also want to move the same 2D object along the y axis (up and down within certain limit and at different speed than ...
dev's user avatar
  • 1
-2 votes
1 answer
209 views

Why does my OnTriggerStay method throw a NullPointerException when I access the collider's attachedRigidbody?

I set the trigger void OnTriggerStay(Collider other) { other.attachedRigidbody.AddForce(Vector3.up * 100, ForceMode.Impulse); } But when player walks on, ...
eon's user avatar
  • 123
-2 votes
2 answers
597 views

Double Click Unity

Have a class, which I am calling from PointerClick(in EventTrigger). Need to recall PointerClick after the first PointerClick((0.2f) seconds later).
GuardFromUA's user avatar
-2 votes
1 answer
78 views

Disabling a script from another script

I have a script that is attached to many game objects. The script simply makes objects drag-able. I want this script to be disabled until a button is pressed. I have used the below code to ...
AzzMan's user avatar
  • 1
-2 votes
1 answer
1k views

How to change the scene in Unity after all enemies have been killed?

I have a script that counts how many enemies are left and changes the scene when there are no more enemies. However, it doesn't work, and I can't find the error. I have a really similar script (it's ...
tomy11010's user avatar
-2 votes
1 answer
96 views

How can I select a sequence of objects by moving mouse in Unity?

I have a board of tiles in my game in Unity and I have to select a sequence of tiles by moving the pressed mouse over the tiles like if I would select letters in a such game like on the screenshot. ...
Alexander's user avatar
-2 votes
1 answer
1k views

Unity3d - Cannot implicitly convert type `UnityEngine.Ray' to `Ray'

I downloaded the free standard assets from the assets store, now I get alot of errors in my console. e.g. ...
Black's user avatar
  • 591
-2 votes
1 answer
224 views

How do I make camera follow player only in a certain scene?

In my other scenes I made it so the camera doesn't follow the player, I only want the camera to follow the player in one scene. How do I do that? This is my follow cam script: ...
gudperson2's user avatar
-2 votes
1 answer
70 views

dependency between engine and 3d model software. Resolution - what is it really [closed]

I have a few questions about gamedev as a beginner. 1) Why someone tells that Unreal Engine has better graphic then for example Unity? I can create any quality model in 3ds max, for example, and ...
FoxNet's user avatar
  • 119
-2 votes
1 answer
63 views

Weird behaviour dragging a UI Image [closed]

I'm making a classic card game in Unity. I created the first deck, and when I click on the top card, it is discarded and moved to a second card stack. When the first card stack is empty, then it is ...
Radioga's user avatar
  • 101
-2 votes
1 answer
105 views

how do you add W, A, S, D controls to unity 5.5

I have a character already in the game files and just need to know how he can move I have looked online in lots of places and it just doesn't make sense to me as I am sorta new to the game development ...
Jonathan's user avatar