Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

0
votes
1answer
29 views

how do i enable and disable objects with a certain tag in c#?

I have a script that is supposed to find every active object with a certain tag and on the push of a button enable and disable it's meshrenderer and collider. but the script only tries to enable and ...
0
votes
0answers
17 views

Unity Terrain Tree tool - couldn't be instanced because the prefab contains no valid mesh renderer

I have a Prefab I have made which is the Obj file dragged and created from there. When I add it to the Terrain Tree tool I get the error: The tree Fir_Tree_ChristmasGreen Variant couldn't be ...
0
votes
1answer
27 views

should my static class be derived from UnityEngine.MonoBehaviour instead?

I am working on creating an object to maintain state of the game, player data, etc. It is static (singleton lifecyle) through the life of my game. I started down the path of a static class, with a ...
0
votes
0answers
14 views

DragonBones mesh gets light by the wrong side

So, I use DragonBones to get skeletal-animation in my Unity 2d game. The problem is that object is affected by light only from the back, while other objects(sprites, while the first one is mesh) from ...
0
votes
0answers
13 views

How can I use Raymarching scene as equirectangular?

I currently output 3D scenes in Unity by rendering cube face textures from a scene camera, as you can see in the below Image: Omnity Cameras From there, I convert the projection to 360^x180^ ...
2
votes
2answers
51 views

To move an object forward an exact distance and then stop

I am using this script below to move an animated object in unity with no root-motion. it simply walks across the terrain and has a timer so it waits 60 seconds until starting. ...
0
votes
0answers
12 views

writing problems with MonoDevelop of Unity 3D

MonoDevelop was automatically installed by UnityHub. The text editor poses a lot of problems because you can not insert a specific character (I position myself, the positioning is not famous and when ...
0
votes
3answers
41 views

Sharing Physics in Unity

I'm making a game with an endless mode where you have to dodge asteroids until you eventually die. Since the game could be endless, I wanted to avoid the coordinates issue mentioned here. My player ...
0
votes
0answers
15 views

How to retrieve the coordinates of an animated object?

On Unity, I created a script in C # to animate a cube. I am trying to create a script in C # which, once the animated object and in support of a key of the keyboard (for example F) returns to me the ...
1
vote
1answer
37 views

Timer breaks after changing scenes

I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain. I have timer attached also so the animation doesn't start to walk for 60 seconds. ...
0
votes
0answers
53 views

Why is Unity MouseLook very shaky and jittery?

I'm working on a first person shooter game. My problem is that my Mouselook script is shaky and jittery when I looking around. Here is my code: ...
0
votes
0answers
29 views

Real Time Physics Based Mesh Deformation [duplicate]

I'm working on a game through unity that draws one of is essential elements from traditional tool forging techniques for building tools and such. I want the feel of the game to be able to create a ...
0
votes
3answers
179 views

Open world loading/unloading with asset bundle in unity

I have a very large environment which I have to load/unload in unity Webgl as I can't load them at once. So, I have divide the environment into 1000 x 1000m (1km) (each chunk is consist of three layer ...
1
vote
1answer
27 views

Unity2d Camara smooth zoom issue

want to know that how mathf.movetowards works, i tried to play around it and have some issues. i want to make the camera moves from player to target places along with zooming upon triggered and vise ...
0
votes
0answers
20 views

Unity Touch Pan Orthographic camera

I have written some code to pan in perspective view. I used that code and modified it to make it work in orthographic view. However, the display does not pan as expected. It just goes all over the ...
0
votes
1answer
11 views

Photon2 Unity2D How to send float with RPC

I have big problem in my code .. I want to spawn obstacle exactly on the same position as on the server is spawned so I made rpc Method and tried to pass random variable of float , but when i run the ...
0
votes
1answer
25 views

Spawn prefabs from list one by one when trigger is touched

I am trying to spawn one gameobject from a list of gameobjects each time I touch the trigger with the controller. But when I do this, all the game objects from the list spawn together at the same ...
0
votes
0answers
37 views

Simulate piston for forklift using PhysX 3.4 ( Unity 2018.3 )

I need to simulate a piston for a forklift, but I don't really know how to create an accurate physics model. The forklift ( a car with some wheel colliders ) should react to the force applied by ...
1
vote
1answer
101 views

Unity – How to keep sprites sharp and crisp, even while rotating

How can I maintain crisp, sharp edges on sprites, while avoiding the aliasing caused by rotation? None of the things I've tried produce a pixel-perfect non-rotated block, while allowing rotation ...
0
votes
1answer
18 views

Unity, errors when using Quaternion.Euler to copy rotations

In the game I'm creating I have a square that rotates around a parent point, I want the square to always aim upright however (think of a rotating platform). What I've done is simply use ...
0
votes
0answers
14 views

NullReferenceException: Object reference not set to an instance of an object [duplicate]

Hi so im displaying food, health an water on the screen in a text box by using UnityEngine.UI and making text variables. They are all defined in the update function so they will keep changing and are ...
0
votes
1answer
25 views

Play games services leaderboard does not work all the time

I am trying to login into play services. I got it working. But there were duplicate game objects created. So I added do not destroy on load and now the play services work the first time I access it. ...
1
vote
1answer
111 views

Why Unity3D 2018 UI looks bad and very sharpy?

I update my project from Unity 2017.1.1 to 2018.3.9 and almost everything is OK except UIs. All of UIs like Images,Buttons,texts,text mesh pro, sprites and others looks very sharpy and pixel pixel ... ...
0
votes
0answers
35 views

Looks like render in Unity ( Light Shaft on Particles etc.)

guys, i hope someone can help me, i want to get a looks like rendering, like a screen, i can buy Aura 2 and use volumetric light to have affect on Fireflies, and make a light shaft / good ray? The ...
2
votes
2answers
136 views

How to run a long task without freezing my game?

I have a component that is in charge of generating a level at runtime, and this is an operation that takes quite some time. As a consequence, I experience a hang when this operation is executed (when ...
1
vote
1answer
30 views

How to manage server “view” of game board when it is shared by clients?

I'm currently creating a simultaneous turn based card game in which two players play cards in three lanes to determine who wins points in these lanes. I've been struggling this past week trying to ...
0
votes
1answer
36 views

How can I show tilemap coordinates in-game in Unity?

I have a game that uses a tile map, and I'd like to draw numbers representing positions on the tile map while playing the game. This would, for example, let me easily write down a note that I want to ...
0
votes
1answer
51 views

How can I debug a black screen when testing on a device?

I have made an Android game with Unity. But, when I opened my game, I see a black screen and a closed game. It works on a tablet but does not work on mobile phones. I tested it on 2 mobile phones. ...
0
votes
4answers
90 views

Why does gameObject.transform.eulerAngles = new Vector3… work?

Apparently gameObject.transform.eulerAngles is accessing a copy, so changing it shouldn't do anything, and in fact using .Set doesn't work. But why does =new Vector3 (..) work? EDIT: Given the ...
0
votes
1answer
40 views

Draw a grid of tiles

I've made a tiledrawer, which takes a list of sprites, and then randomly picks one of those sprites, and draws it in a 2D grid. This works, but I have a feeling I'm not doing it the right way. When ...
0
votes
1answer
41 views

Why the lockState of the doors is all the time false even if in the editor I set one of them to true?

In the DoorsLockManager in the class DoorClass I changed in the editor one of the lockState to true but when running the game they are all change to false including the one I tried to set to true. Not ...
1
vote
1answer
37 views

Video feedback effect with recursive RenderTextures in Unity 2018.3

I have a project where I'm playing with a video feedback effect by rendering a camera to a RenderTexture and pointing the camera at a quad displaying that RenderTexture. This works great normally, ...
0
votes
1answer
42 views

Play a sound on button click before loading the load scene in Unity3D

I am trying to play the sound of the button click before loading the scene in unity. However, the sound is never played. Below is my code, help would be appreciated. ...
0
votes
0answers
15 views

Is it more efficient detect when audio clip ends with AudioSource.isPlaying or with AudioClip.length?

In Unity, I want to trigger an event when an audio clip finishes playing. Would it be more CPU efficient to keep checking if the audio clip is playing with ...
0
votes
1answer
32 views

Unity WebGL player just shows black screen

I built my Unity project with WebGL. After load the resources, I can hear the music and player sounds(movements etc), but it just display black screen only. I found some similar situation in google, ...
0
votes
0answers
15 views

How launch Twitter app Android in unity? [duplicate]

How Can I Launch Twitter app On Android device I see below link but it is not work:(I could not launch with username Or with ID): https://answers.unity.com/questions/842660/how-to-open-twitter-page-...
1
vote
1answer
18 views

RaycastHit.point to local coordinates

I'm trying to detect where approximately an enemy in my game has been hit. I have added a box collider with a height of 1.8 metres to the enemy. When the player then shoots, I use a RaycastHit to ...
0
votes
2answers
44 views

Sending a shot left/right/up/down based on directional key press

I am trying to make a top-down shooter game with similar combat to the Binding of Isaac: when I press the up key the shot goes up when I press the right key the shot goes to the right I have all ...
0
votes
1answer
31 views

Quaternion.LookRotation with Joystick

I am having an issue i cannot seem to figure out within my code. What this code does at the moment is that it rotates the 3D Model around the z axis but i need it to rotate around the y axis. Any help ...
1
vote
0answers
18 views

Prefab sorting layer wrongly displayed

I have a prefab 'WhiteSmoke' that should render on top of the other objects on my game view but instead it just stays behind. The sorting layer some you see on the image named 'smoke' is the top layer,...
-5
votes
1answer
44 views

How to create “Hexagon” GameObject in unity

So i'm making a mobile 3d game, and i need to have Hexagon gameobject and yeah i searched the whole internet but didn't find any solution (i've tried blender to create hexagon but it didn't work, when ...
0
votes
0answers
19 views

How to freeze the FPS controller movement with script in unity?

I've been developing a game and I need to know how to freeze the Player position at certain point when player perform action by pressing a button and make only able to move the camera limited range on ...
0
votes
4answers
47 views

How do I make TextMesh Pro go invisible when at a distance from the camera?

I'm building a 4x game. I've rendered the galaxy, and I want the text below each star to disappear when I'm zoomed out, so it looks nicer. My stars are Prefabs with a star sprite and a 'UI' ...
2
votes
4answers
224 views

High performance screenshots in LWRP

I'm trying to capture some screenshots for my game. They need to be saved as jpgs to a folder, latency is not an issue, I don't care if it happens over 10 seconds. My number one priority is to keep ...
3
votes
2answers
111 views

How can I create a random deck of 7 cards every time they are all used?

I'm trying to create a Tetris like game in C# (Unity) and I've run into quite a problem on how I can generate 7 cards (tetrominoes) of which none are the same and when I run out of cards, I regenerate ...
0
votes
1answer
17 views

Unity Canvas hover image does not trigger event

So i have the following setup: This produces the following UI: Now on each of the "HudCircle"(Bottom/Right/Left/Top), I have the following components: As you can see I have a script that has the ...
0
votes
0answers
14 views

Can't refer mesh size after using .BakeMesh() in Unity

I can't figure out how to refer to the size of a particular mesh. The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box ...
0
votes
0answers
40 views

Simple shader that scales UI image from the center

I'm having trouble making a (vertex) shader that scales UI images from the center. I can scale the image, but the image doesn't stay centered. Here is a project showing the problem Here is a ...
0
votes
0answers
24 views

Spawned Network Object with rigidbody moves at different velocity/angle/pos on the clients/host - Unity Unet Mirror

I am using Mirror API with Unity 2019 to make a basic multiplayer game. The game is a simple ice hockey style with cylinder shaped players and a cylinder puck. The players are spawned by Network ...
0
votes
1answer
29 views

In Unity how can we implement the Bull Rider Controller?

There is a Sports (Bull Rider) in which a person sits on the top of a Bull and grasps the rope to controll a Bull. The Bull kind of moves to and fro. The player has to balance him/her self. I have ...