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
1answer
46 views

How to use AddForce on a capsule?

I created a simple scene, with a box that serves as the ground, and a capsule that serves as the player. I added to the player a RigidBody, and a component that should move it using AddForce: ...
0
votes
1answer
30 views

Static function is being called, but if statement within is not working

I am trying to make a game where upon the player stepping on a block, the block will change color. I am doing this by using transform.position with the player character being recognized as 1 above in ...
0
votes
0answers
18 views

Maintain UI position with Aspect Ratio Fitter and anchor preset is set to stretch

So i have a text UI using Aspect Ratio Fitter with Aspect Mode Height Control Width and i set anchor preset to stretch upward . To make it easier to understand , i want my text to stretch upward ...
0
votes
0answers
19 views

HDRP Decals, how to fix streching decals

Is there a quick way to fix strenched decals when they don't quite perpend. to the normals in it's entirety? What I do now is to get the normal of the surface and rotate decal accordingly, but with ...
0
votes
2answers
81 views

Can I replace the source image of slices by script?

I have a Unity2D prefab that uses several slices from a single PNG. (in it sprite renderer, and in its animation clips). If I replace that PNG in the Finder, all slices taken from that PNG are ...
0
votes
1answer
31 views

OnTriggerEnter works…sometimes

I was working on a small game in which you shoot projectiles towards various targets, now I decide to use OnTriggerEnter instead of OnCollisionEnter because OnCollisionEnter adds a slight force to the ...
0
votes
0answers
23 views

Rigidbody with many colliders has strange inertia

I've had some feedback from my game that "gravity feels weird and moon-like". After some investigating I found that some of my objects do indeed behave as though they are on the moon. I can confirm ...
0
votes
1answer
23 views

How to keep the object rotation while using RotateAround in Unity?

I've got an object that has a comet-like sprite rotating around it. I'm using this code in LateUpdate() to make it rotate and keep the comet's tail at the right ...
0
votes
1answer
22 views

Remove Sprite Shape Controller Icons from 2D sprite shapes

How do I get rid of those "purple icons in my scene"? They are so annoying ... they literally covers the entire 2d shape! GIF showcasing it
3
votes
2answers
2k views

Finding the closest point on a concave mesh (Unity C#)

One of my game systems requires that I find the closest point on a generalized mesh, which more often than not will be concave. This prevents me from just using Unity's built in ClosestPoint function, ...
1
vote
0answers
18 views

How do we export blender material with shaders and blender texture to unity?

I've blender model, it has noise texture and glossy shaders, when I import it to unity, they are not the same. I tried both cycle and Eevee render and was looking for different ways to export the fbx ...
0
votes
2answers
61 views

Unity getting Input from UI

So I'm trying to get a script of mine to pass information to another static class being used for saving files as I've been told I wouldn't want that script to be instantiated. So I used a separate ...
0
votes
0answers
65 views

SSAO in my unity games has flickering lines at the top and right side of the screen

I've tried both the built-in unity ambient occlusion that comes with the post-processing stack, as well as another one ported from the Microsoft MiniEngine by someone: https://github.com/keijiro/...
0
votes
0answers
29 views

Player losing alignment with tilemap after moving

I'm using an isometric tilemap(2:1) and I can't figure out how to make grid based movement on it's surface. I managed to get a code working for the grid based movement, moving my character with 0.5 ...
1
vote
3answers
82 views

How to store information into the tile?

I have made a map via TilePallete tool. Now I want to store information in certain tile. How I can do this? ForEx: I'm hittin a certain tile and I need it to have info about health remaining. For ...
-1
votes
2answers
24 views

conditional statement stop and run 2 coroutine unity

The scenario will look like this: IE 1 will spawn the enemy, until the player kills the enemy and has enough points, IE 1 will stop and run IE 2. IE 2 runs spawn coin after 10s IE 2 stops and IE 1 ...
0
votes
0answers
18 views

Animator prevents swapping spriteRenderer source sprites at runtime

Background: Unity 2019.3. I'm using an animator component on a parent gameObject to play animations involving multiple body part gameObjects with individual spriteRenderers (see below). ...
1
vote
4answers
2k views

Start Countdown on Resuming Game (Unity)

I am pausing game by setting Time.timeScale to 0. And When the Game resumes Time.timeScale is set to 1f again, and game resumes. Now I want to add timer before actually resuming game. It shows 3,2,1,...
0
votes
2answers
34 views

How to create a countdown timer that shows hours, minutes and seconds in unity?

Kind of an easy question but everything I have found on this topic is either outdated or only counts down numbers and not time which is what I need. How can I go about creating a countdown timer where ...
0
votes
0answers
18 views

using Playerprefs on Android Mobile Platform

I have a question about playerprefs on my android mobile game not initializing properly. I have already pre-set my playerprefs data on a variable with a value of 3. In my play mode on unity the value ...
0
votes
0answers
34 views

I am trying to make a fast paced online shooter using Unity's physics. Help

So I really want to make a 3d online shooter with a rigidbody controller. I don't use Photon or UNet, instead, I use custom-built package management & internet communication. Link to the tutorial ...
0
votes
1answer
49 views

Unity UI glitches while loading

I have the following scene canvas elements: ...
0
votes
1answer
52 views

Rotating objects in an random rotation around center point

I almost have what I'm looking for. Still trying to understand rotation and spawning of objects. I have a ground field with a number of spawn points (and they are placed randomly in a circle). It's ...
0
votes
0answers
18 views

Unity2D: Floor tiles moved or missing

I'm following the 2D Roguelike tutorial, which can be seen here. I don't want to get fancy, just follow the existing steps. I've reached the part where all it's supposed to do is draw the playfield. ...
0
votes
1answer
20 views

Directory.CreateDirectory() created a folder with name that was supposed to be a file

i am experiencing some problem here , i have a path : "/folder/folderagain/file.xml" i tried to use Directory.CreateDirectory() to create all folder (in case one of them is missing) and then reuse ...
0
votes
1answer
7 views

Unity: Exporting prefab includes a lot of unneccessary assets dependencies

I just exported one of my assets into a unitypackage. It included all dependencies very nicely so I can use them. Then I tried ...
0
votes
0answers
12 views

Do Unity bunch up similar materials automatically?

Imagine I have materialA and materialB. materialB is a direct copy of ...
0
votes
2answers
777 views

Unity 3d texture animated round circular bar

I'm struggling to create a circular bar with an animated texture and a round cap end. What I would like to create is implemented in the Unity game Subnautica - the bottom left bar. So here is the HUD ...
0
votes
0answers
7 views

GridLayoutGroup items maximizing area with scalable items

How can I make GridLayoutGroup to scale children keeping their aspect ratio, with no overflows?
0
votes
0answers
16 views

How to simulate an object that breaks due to falling from height?

I would like to simulate an object (e.g. an egg or a barrel) that, when it is thrown from a high position it shatters to pieces, but when it is thrown from a low position it does not shatter. One way ...
0
votes
1answer
24 views

FindObjectsOfType returns null array

I am making the game in this tutorial: https://www.youtube.com/watch?v=OR0e-1UBEOU and at 2:53:23 he is coding a LevelController script. I noticed that mine wasn't working the way his was and so I ...
0
votes
0answers
13 views

Unity Ads doesn't work after a while

I apologize for the bad English. We've implemented a class with some Unity ad features. Everything is going very well from the beginning. After showing me the ad a few times, it doesn't work anymore. ...
1
vote
1answer
20 views

Unity difficulty placing text within the reference resolution of the canvas

I have a TextMeshPro GameObject, which I placed within the Canvas. The canvas is set to Scale with Screen Size and has a reference resolution of 1440x1080. The ...
1
vote
1answer
36 views

Calling Prefab MonoBehaviour Method before Start()

I'd like to do the following: ...
0
votes
1answer
35 views

How to create 3D area mask?

I have two cubes, one parent and one child. I want to use the parent's cube mesh as a mask for the child cube. I want to make visible only the part of the child cube that it is inside the parent cube. ...
0
votes
1answer
21 views

Basic rigidbody movement

This is a noob question but, what is the rigidbody movement equivalent of: transform.position += transform.right * speed * Time.deltaTime;
0
votes
0answers
13 views

Entering prefab chokes Unity

I have a mesh that isn't very performance intensive. Several thousand vertices if I remember correctly. This mesh has 13 materials attached to it.(2K textures). And a rig. I'm running HDRP. ...
0
votes
2answers
61 views

How to increase points per second when speed increases

I am making an endless rider game that is crossed between tron legacy and cube field. I am trying to add a point system were the faster you go the more points you get because you are more likely to ...
0
votes
1answer
44 views

Enable SteamVR hand collision for when holding objects

Just getting started on a game project with SteamVR in Unity. I've run into an issue with the collisions though. The hands and the objects that can be held collide with everything in the scene as they ...
2
votes
2answers
2k views

How can I create a fog-of-war based on character line of sight mesh and a shader?

I've a 3D-game using perspective view, through raycasting, I create a mesh that represents the line of sight of my characters. I'm looking for a way to "darken" (think old-school Fog of War - ...
1
vote
1answer
42 views

How to scale player as they travel between 2 points

I'm doing a VR Project where the player walks down a hallway. The player starts with a size of 10 and is supposed to scale down to a size of 0.5 (well the GameObject in which all the player stuff is ...
0
votes
1answer
52 views

Make enemy follow player intelligently

I was trying to make a script to make my enemy follow my player intelligently (but not too much) and I want to know if there was a better way to do it (of course there is but I wanted to find a way ...
0
votes
2answers
34 views

transform.position returning wrong value (UNITY 2D)

I am trying to place the ball on the paddle until a key is pressed, also there is box collider that triggers if the ball falls down. For some reason the transform.position.y of the ball gameObject is ...
0
votes
0answers
11 views

How do I get information from a user who is not in my friends list? (Facepunch.Steamworks)

I'm using Facepunch.Steamworks and i can't seem to find the equivalent to SteamFriends.GetFriendPersonaName(steamUserID);.. I just found a way to list all my ...
1
vote
1answer
40 views

Unity drop items enemy sprite size problem

how can i make items drop infront of the enemy without getting hidden under the enemy sprite due to the size of different enemies. I would also like to spread the drop items How currently it is How ...
0
votes
1answer
9 views

How to search for all uGui scripts in scene in the Unity editor?

I have many game objects whose properties I need to edit because of a bug/error. However, this is very time consuming, because I need to check each game object one by one. Is there any way to search ...
0
votes
1answer
1k views

How to import character package in Unity

I recently made a game in Unity 3D and I tried to import the FPS Controller package as the tutorial I was following said, but when I clicked Assets/Import Package the only thing I saw was a button ...
0
votes
0answers
21 views

How do you exactly implement a Semi-Implicit Euler type of movement in a 2D platformer?

So I've been following along Sebastian Lague's 2D platformer tutorial, and to understand exactly how the physics of how a jump is done, I dug into the subject and noticed a lot of people, from ...
0
votes
0answers
11 views

Correct way to animate player's looking direction

My character shoots lasers from his eyes. Thus, I want to add animations where the character looks up or down. Soon enough, my state machine looks like this. And there are many more animations to add....

1
3 4
5
6 7
245