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
1k views

Why the OnCollisionEnter is not working?

This script is attached to the wall(3D Cube) with a box collider : ...
6
votes
5answers
30k views

How can I make my Camera's RenderTexture output have a transparent background?

I'm writing a 3D game using Unity 2017.1.0b1. I have a disabled Camera that takes a "snapshot" of the current scene and stores it in a RenderTexture when a button is clicked. I then display the ...
0
votes
0answers
8 views

Integrating gpt2 into unity

I was wondering if anyone had any pointers in integrating gpt-2 into unity. I've got quite a bit of experience with python, but less with unity. What I'm trying to do is use a pretrained gpt2 model in ...
0
votes
1answer
107 views

Unity Script and game not syncing after player respawn

I have a health system for my player that looks like this: ...
-1
votes
3answers
2k views

2D sprite is 'blinking' when animation is playing [closed]

When I fire a bullet, instead of frames 4 and 6, the sprite selector in the sprite renderer component says "Missing (Sprite)" and 'blinks' for a frame, not showing anything.
0
votes
0answers
6 views

Why does my custom mouse cursor revert back to normal in Unity?

I have set the mouse to be a custom cursor under Edit > Project Settings > Player. (I set the cursor with script originally and had the same problem.) In the editor it shows up as the system ...
0
votes
1answer
26 views

How can I save a scene which consists of continuing text?

I am trying to make a simple book reading app. In scene, it will show only one word from the book every 0.5 seconds. What I want is, when I click pause then quit the game or just back to Main Menu and ...
1
vote
1answer
19 views

Vector Rotation - Casting a Cone

I'm working on an obstacle avoidance system in unity, and my thought is to cast a sphere along the velocity; if it hits, draw a ring of spheres around that one and repeat until max ring count or a ...
0
votes
0answers
14 views

Forward movement while rotating lead to flickering

I'm trying to make a ship move forward while also turning, but when I start to play, the ship flickers when it tries to move and turn at the same time. In the ...
0
votes
1answer
37 views

How can I create noises when character is running using this audio manager script?

So I used this tutorial: https://www.youtube.com/watch?v=tLyj02T51Oc, to create an AudioManager that can be easily called from other scripts, and can fade sound effects. One thing I do not know how to ...
0
votes
0answers
20 views

Character bounces when platform goes up and down

I have a player character with a few 2D Colliders and a Rigidbody 2D attached to it. When sitting on a platform the player ...
0
votes
0answers
12 views

how to remove void from mesh on unity

I want to make a procedural generation of the world and biome and so that they have different heights, but it looks bad for transparency, please help
1
vote
1answer
45 views

Why does my collider behave strangely after a coroutine

So I'm trying to create a simple script that is going to handle the logic for cutting down a tree I'm experiencing some strange behaviour with my script. I have a private field which holds the "...
0
votes
0answers
18 views

Issue with player landing on moving platform - Infinite Runner

I’m making an infinite runner game and have it set so that the platforms move to the left rather than the player moving forwards. My issue is that I have a platform the loops up and down as it moves ...
0
votes
2answers
45 views

How do you create a power-up system that isn't welded to the Player script?

I have various powerups in my game that do different things. They are handled through ScriptableObjects for their UI sprites, descriptions, names, duration, etc. They have a begin, tick, and end state....
-1
votes
0answers
11 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 ...
0
votes
0answers
10 views

How do I display canvas world space on top of everything?

I want to make a display of enemy HP information through walls. And also a tag above the enemy, like in FarCry. The dual camera method is not a good idea because it is VERY slow performance. (Was ...
0
votes
0answers
24 views

Generating code on file changes in Unity Editor

I'm trying to generate code on changes using file watchers: ...
0
votes
0answers
15 views

How to teleport a kinematic Rigidbody2D with the interpolation settings on?

I would like to start by quoting some parts of the documentation. The first thing that catches my eye is the difference in the description of the MovePosition ...
1
vote
1answer
43 views

Unity UI - Make text come out and go back in

In Unity UI I have a TextMeshPro Button and some TextMeshPro Text like in the following image: Is there any function in a Tween Library like DOTween that could make the text look like its coming out ...
0
votes
0answers
11 views

Texture appears black when EditorUtility.CompressTexture()

I'm working on an textureAtlas builder, the atlas itself is a scriptable object which holds settings and reference to source meshes and materials. I have the actual atlasTexture as a subAsset of the ...
0
votes
1answer
132 views

Render texture seems to ignore camera background type

I'm currently trying to pull a fog of war for an rts game, and planned it like this. (Unity 2020.2.7, URP 10.3.1) Use units field of view to generate a texture of what is seen (alpha 0). Create other ...
0
votes
0answers
12 views

Unity hands not showing and shaders are tinged pink when deploying to Android and running on quest

So when I run in editor ( 2021.1.16) everything works and looks good however when I deploy to my headset as an APK my Hands are not shown and everything has a strange pink tinge to it. Its not the ...
0
votes
1answer
29 views
-1
votes
1answer
18 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 ...
0
votes
1answer
255 views

Mathf.Clamp not Working Properly

I want to clamp the vertical rotation of the first person controller I was making. I want to restrict the vertical rotation of the main camera between -90 and 90 degrees. The code is as follows: ...
1
vote
1answer
254 views

Character moving without control

i've been developing a third person adventure game on Unity with a grappling hook and i found a problem that i don't understand and it's driving me mad. Basically, if the player character collides ...
1
vote
1answer
47 views

How to make my Unity project deterministic for replays?

I am working on an arcade-style 2D shmup and recently started implementing a replay system that allows players to view their runs of the game. I use the technique of recording input each ...
0
votes
1answer
32 views

Switching out the mesh of a game object at runtime

I am trying to switch out the mesh of a game object. I have this script: ...
0
votes
1answer
74 views

Player light color he collects before checkpoint is getting reset when he restarts at checkpoint

I have a child object for my player called Light. The light color changes when the player touches balls of different colors. When I respawn at a checkpoint, the light is getting reset to the default ...
0
votes
0answers
22 views

How to check if object is inside another

Im creating a city building game, and i need to check if the building is 100% inside the grid, which is currently a 3d cube (using only the X and Z coordinates of the building) i thought to take the ...
0
votes
0answers
13 views

How to generate a randomly-positioned leaf quads with a geometry shader?

Does anyone have any idea how to implement a shader that manages to make this effect in Unity? I found a post that explains, but I'm still learning shaders so I didn't really understood how to go ...
0
votes
0answers
11 views

Ensuring world curving shader is not affected by object scale

I've made a shader shown below which essentially acts as a "world bend / curve" shader by "bending" objects depending on their position from camera. It's a subgraph that outputs ...
3
votes
1answer
379 views

How do I get an object to rotate in world space via RigidBody.AddTorque?

I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another ...
0
votes
1answer
79 views

Unity update sizeDelta in OnValidate based on Layout Group computed values

I'm trying to update the sizeDelta of a RectTransform in OnValidate. I'm trying to grab the computed values from a Layout Group. Here's what I've got: ...
0
votes
0answers
10 views

Unity addressables errors with Android split binary

We're using Unity 2020.3.18f1 and Addressables 1.19.4 (we've also tried 1.18.15) Google requires us to split the game up before uploading it to the google play store. We built the game into an .apk ...
1
vote
2answers
287 views

Unity Mouse position for weapon wheel

Say i have the following wheel: Now i wish to use the mouse to select weapon by movement: So If mouse is to the left it picks the Sword if mouse is at the top it selects the bow and arrow if the ...
0
votes
1answer
19 views

how to add overall collider to a bunch of circles or boxes?

I have 3 circles (2D) they all have circleCollider2D. what I want is to make a collider that make border around them. I can't express which type of collider I need, so I put example image below. Red ...
0
votes
0answers
10 views

Confused on OpenglES uniform buffer alignment

I am now doing some customization to Unity Engine. I am trying to optimize the rendering process. I observed that each time Unity build a batch, it will create a new uniform buffer to pack bulit-in ...
0
votes
1answer
29 views

Clipping speed when turning without using aggressive drag

I have a Unity project in which I want to control a player in a similar way to Source games, and so far I am clipping each input to the speed in the player's coordinates, by using ...
0
votes
1answer
130 views

Problems blending biomes together in relation to moisture/temperature

I am trying to achieve smooth biomes blending for my procedural 3D terrain. I've been doing some research on this creating biomes topic and I found some good sources that talk about creating biomes by ...
0
votes
0answers
17 views

How to get a reference of a script from prefab child?

The Scene Fader prefab is dragged to the OnGameLoading script : The scene fader prefab structure is with two children and the script I need to get a reference to is on the second child : And the ...
0
votes
1answer
113 views

How can I set up a 3D camera for a top-down game like Enter the Gungeon?

DodgeRollGames, the developers of Enter the Gungeon, tweeted that the game was in fact made in 3D They tried to explain how they set their camera in this reddit post. Basically what they said was : ...
-1
votes
1answer
32 views

How can I detect when the mouse cursor is over a button?

Not clicked event but over the button event ? I want that when the mouse cursor is on the button call a function. When I click on the button it's calling the function playing a sound. I tried to add ...
2
votes
1answer
53 views

How to draw a box in Unity Runtime?

I'm currently working on an AR application that is able to measure volume. The functionality is required to draw a box is in the gif attached to this. I have tried to generate instantiating 3 points ...
1
vote
1answer
2k views

How to design prefabs in Entity Component Systems

In Unity (and I presume other game engines) you can create "prefabs" which are blueprints for game objects. They contain a list of components, and default values for those components. Prefabs can be ...
0
votes
1answer
57 views

Moving camera vertically only after player is too high or too low

In my 2D platformer game, I find it very exhausting for the player if the camera follows the player all the time. So, I looked up for some tricks to make camera movement feel more natural. The first ...
0
votes
2answers
652 views

How can i properly display 2D Pixel sprite's pixels without distortion while it's moving ? (in unity)

Introduction to what i'm trying to do Hi, I'm trying to make a 2D Pixel Platformer Game in Unity. Before that i used godot and for some reasons (not about the engine) i switched to unity. And in ...
0
votes
0answers
16 views

Google's Play Asset Delivery Build aab File in Unity too large

I want to upload an aab file from my unity project to my play console account, but unfortunately, my file was rejected because it's size is larger than the 150MB threshold limit for aab on google play ...

1
2 3 4 5
290