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
0
votes
2answers
55 views

Destroy gameobject that is returning a RaycastHit2D?

As the title suggests I would like to destroy the game object that my raycast hits. I have a movement script attached to my player object. A raycast2d is continuously shot downward, and when it ...
0
votes
2answers
323 views

Detect up and down slopes to switch between character animation

There's a player and a slope in my scene. I want the player to automatically switch to 'climbing down' animation when he's at the top of the slope and moving down and similarly switch to 'climbing up' ...
0
votes
7answers
18k views

Unity create Animated Tilemap?

Im trying to create an Animated Waterfall Tilemap from a tutorial video. In his video when the author right clicks he can see a Animated Tile > under CREATE option. But In my case its not there !! ...
0
votes
0answers
12 views

Translating mouse position to world position yields constant result [duplicate]

I am building a topdown 3d shooter. I want to find the position of the mouse in the world so I can shoot a bullet from the player's position towards the mouse position on mouse click. So to begin with ...
64
votes
11answers
169k views

In Unity, how do I correctly implement the singleton pattern?

I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating ...
0
votes
0answers
42 views

How can I distort a 2D mesh when moving one (or more) vertices?

I use Blender to show examples. I want to do this in Unity on runtime. The outside corner vertex will be moved passed edge and the triangles appearance will be messed up like it shows on the second ...
0
votes
1answer
18 views

Unity 3d when camera is closer the shadows getting clipped weirdly

When in distance the shadows are appearing correctly but when getting near to the shadows it is getting clipped in a weird way. I was not able to fix it. Any help would be appreciated.
0
votes
2answers
932 views

Unity adding objects through script to scrollview (SetParent): Objects overlap

I need to add X objects to a scrollview. I do it like this: ...
1
vote
2answers
1k views

How to make an EditorGUILayout.TextField accept multi-line input in a custom inspector

In a regular inspector: [TextArea(4, 100)] [SerializeField] private string message; Will expand a text field and let it accept multiple lines, with enter as ...
1
vote
2answers
42 views

Limit rotation/direction of two axes with seperate values (Vector3)

Issue I'm trying to create a vector pointing in a direction towards a target, and then using that vector rotate a child transform to face the target while limiting the rotation on the X and Y axis, ...
0
votes
1answer
633 views

How to change player objects when switching scenes?

I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can ...
0
votes
1answer
23 views

Unity Hub on Linux "Not enough space" download error

I just downloaded and installed the official Unity Hub app on my Ubuntu machine. However, when I try to download the latest version of the editor, an error message pops up: ⚠ There is not enough ...
0
votes
1answer
20 views

Unity UI Image not rendered?

In Unity I created a Panel with 3 children (An UI Image (LogoAch), and 2 TextMeshPro components (Name, Progress)). It looks something like down below: I saved this as a prefab and I try to instantiate ...
0
votes
0answers
24 views

ECS multithreading without value types?

Im working with an Java based ECS framework called "Artemis ODB". Its great so far but it lacks multithreading or jobs. So i wanted to add them by myself. I actually wanted to give each job ...
0
votes
2answers
60 views

Convert Byte[] to GameObject in webgl

Currently i am using the package to download zip file which contains 3d models in obj format. The download has been completed and converted to byte[], but I am not finding any way to convert the byte ...
0
votes
0answers
27 views

Unity - How to export equipment properly from Blender?

I'm trying to work out the Blender-to-Unity workflow for equipable items. At the moment, I've got a character animated for running, idling, jumping, etc. Now, I want to add equipment for him. I ...
0
votes
1answer
398 views

How do make a box collider align with a line renderer continuously?

I am having the issue of aligning my BoxCollider2D with my linerenderer. I am trying to have a laser shoot using: ...
0
votes
2answers
82 views

The camera goes up and down when following a rolling sphere

I have this CameraController script attached to my camera, to follow a sphere that moves using WSAD. ...
2
votes
1answer
3k views

How to reset RectTransform's position?

So, I am trying to make a simple GUI Instantiate system. The GUI is going to spawn successfully, but the position is wrong. ...
1
vote
2answers
346 views

In Unity, how do I set constant player numbers such that all network clients agree on them?

We are currently writing an online game in Unity. The essential idea is that it is structured like a split-screen, couch co-op game, with the online being offered as an extension to allow multiple ...
0
votes
1answer
31 views

How do I convert 2d character rigging animation to frame by frame sprite animation?

In this video after about the 8th minute, he says he converted them from character rigged animation to the frame by frame animation, so I searched but couldn't find any answers on google. How do I ...
1
vote
1answer
3k views

How can I remove Unity Hub in Ubuntu?

I installed Unity Hub 1.4.0 and it works well. For now I want to update the version of Unity. I need to install hub 2.0.0. But when I download the 2.0.0 hub and intsall it always link to 1.4.0 and I ...
0
votes
0answers
27 views

Predicting angle of projectile trajectory

I'm making a game, where the player and AI shoot projectiles. Projectiles have their own speed, drag and gravity modifiers. I update my projectile velocity in FixedUpdate (I use Unity engine). ...
0
votes
0answers
16 views

Unity with VS Code: .sln generated is missing assemblies. Only .sln generated by Studio works (with Code as well)

After every Unity update I have a lot of problem with missing assemblies in Visual Studio Code. ...
1
vote
1answer
62 views

Why the distance is never less than 1?

The distance is 1.07 and changing sometimes at this point the distance is 1.06 or 1.07 more or less this range. ...
0
votes
0answers
21 views

How to make a select box with a rotatable camera in unity?

How to make a select box with a rotatable camera in unity? this is my camera The way the camera rotates is to rotate the main camera, which is a child object from the parent object, around the origin....
0
votes
2answers
3k views

How to restart the timer after using deltaTIme

I am creating a simple game interface. When fillAmount > 0, the timer is stopped and reset. I want to restart the timer if the fill amount does not change for 3 ...
0
votes
1answer
410 views

OnMouse Events stop working when multiple cameras are active

I'm working on 2019.4.9f1 on a 2D project using Universal Rendering Pipeline. The camera settings changed so I'm stating it. I wrote a OnMouseEnter and ...
0
votes
2answers
61 views

Help with multiple powerup types

I am trying to have a single class that handles multiple powerups types and using enum for the types of power-ups and switching the powers based on enum however when there are multiple power-ups in ...
1
vote
1answer
48 views

Why do my bullets always go the wrong way when my player turns around?

So I tried to make a shooting mechanism for my game. My player can shoot in the direction pointed by the mouse. My player can also turn around, facing the other way as he walks. The firing mechanism ...
0
votes
1answer
26 views

How do I add force in all directions on point of touch or mouse click?

I wanna add a force on the point of player touch. Basically when player touches a point it release force in all directions and all sprite in its range get effected and start moving. What is the right ...
0
votes
1answer
31 views

Change Sprite's Position

I have a sprite attached to the player like an accessory and it flips along with the player when moving in the opposite direction. However, due to the player being a dog, when flipped, the accessory ...
0
votes
1answer
37 views

Audio Plays A Second Time When Going Back To Menu Unity

I am trying to have my background music keep playing in between scenes, but the music just plays another copy of itself instead of destroying itself to let only one copy play at a time. This is my ...
0
votes
1answer
63 views

Combining cubes Issue in Marching Cubes

I was trying to implement the marching cubes and combine every little cube this way: I get a cube of vertices depending on their surfaceLevel I look for the ones that are below the surfaceLevel and ...
1
vote
0answers
32 views

Object does not follow path correctly

I am trying to have an object follow a path which basically is a square: the object moves to the next corner and pauses for some time. The movement is correct initially, however, after sometime it ...
0
votes
1answer
46 views

How to perform 2D vector graphics operations in Unity

I am currently working on a game that is drawn completely by 2d vector graphics operations like e.g. drawRoundedRectangle drawPolygon fillRect withBlur How can I perform such vector graphics ...
0
votes
2answers
255 views

Creating dependent values in the Unity inspector

I want to create a few values which will be dependent on each other. Specifically, I want total sum of few values always be 100 In unity inspector no matter how I tweak them. E.G.: ...
0
votes
1answer
67 views

Circular draggable UI element in Unity canvas

I am trying to implement my own runtime color picker that's easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when ...
0
votes
1answer
102 views

Mathematical equation for CHOMP AI?

Players take turns in taking a rectangular bite out of the bottom right corner of the bar, by shading a square, tighter with all the squares below and/ or to the right it. The top left-hand square is ...
0
votes
1answer
2k views

What is the best way to create a square grid in Unity?

So I need to create a square grid like the one below. And be able to click on a square, the square you chose then is filled with a different color as well as all the squares right and below the square ...
-1
votes
0answers
19 views

Object reference not set to an instance of an object when scene restart [duplicate]

i made an object that add to int value on collision (playermoney script on empty obj on dontdestroyonload) but if scene restart (it restarts on collision with obstacle) on collision with object that ...
-1
votes
1answer
27 views

Error CS0234 and CS0236 in Unity

I'm trying to make a simple button perform an action when pressed. Initially I was using vscode, but as I couldn't solve the problem, I switched to visual studio 2017. For some reason the error ...
6
votes
3answers
10k views

Lights shining through walls

I'm currently having a problem with lights in Unity. They shine through walls for some reason. Point, directional, etc. If a light is next to a wall on one side, you can see it on the floor on the ...
0
votes
0answers
53 views

Unity is smoothing my low poly models, how do I control this?

I started a new universal pipeline project and have modelled a really quick low poly character in blender. It stays quite blocky in blender, but when dropped into the unity project its really highly ...
0
votes
0answers
19 views

Adjusting custom 2D transform gizmos to work with rotated shapes

I am trying to coding 2D transform gizmos with Rotate and Scale options. There are only two button. One is for rotate the object and another one is for scale the object in local space: GIF If rotation ...
0
votes
0answers
37 views

How to lock an image once dragged & dropped in the correct position?

This drag and drop function in the code below works absolutely fine. Here when the correct image is dropped on to its correct place it stays, but how can I lock the image once it's dropped in its ...
0
votes
1answer
18 views

SteamVR No Longer Opening With Unity Projects

I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR. I did not make any changes to SteamVR recently, and I get ...
0
votes
1answer
82 views

Show world space UI object on top of the Mesh

I want to show object name whenever mouse over happens on a certain object and here is my code snippet that trying to place World space UI image object on top of the object. ...
0
votes
1answer
207 views

Google Admob GDPR compliance - Unity

I have created a unity game that uses admob to show only rewarded video ads and there are no banner/interstitial ads in my game. Is it mandatory to take user consent (for EU countries) for showing the ...