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
0 answers
22 views

How to increase performance of Android AR scene

I'm wondering how to improve speed on this scene for AR on Android, since it's still sluggish. From what I could see, Unity instanced the particle system meshes automatically (is that correct?). I'm a ...
user avatar
0 votes
1 answer
64 views

Displaying a RenderTexture in 2D

I'm new to Unity and game programming, so I apologize in advance for any embarrassingly bad stupidities. I'm not having any luck trying to reproduce the RenderTexture example at the bottom of this ...
user avatar
1 vote
1 answer
143 views

Getting data out of an AoT Dictionary in Unity using Visual Scripting

I have a NormalizedWidth AoT Dictionary with a Key of type String (basically, the alphabet)... and a Value of type Float. You can see it on the left side of this screenshot: Here's what I'm doing: I ...
user avatar
  • 163
2 votes
1 answer
107 views

How to design an upgradeable skill system?

In my game skills can be leveled up to modify base stats like reducing cooldown by 20% and increasing fired projectile count by one. How would I architect the system so that each skill has its own ...
user avatar
  • 63
0 votes
2 answers
60 views

Why is Vector3.ProjectOnPlane() "drifting" further from desired rotation on steep slopes

I'm writing a simple player movement script in Unity 3D, and I've been using Vector3.ProjectOnPlane() to accomplish slope/ramp movement. For the most part, this ...
user avatar
0 votes
0 answers
26 views

Unity's Collider.OverlapCollider is not consistent

I am making a 2D level editor and when I am placing a sprite over another collider it should prevent me from being able to place the item. When the collider being placed is completely over an item it'...
user avatar
6 votes
2 answers
3k views

Emulating the use of video memory (the Space Invaders fortress problem)?

I'm a veteran programmer, but I'm new to Unity and game programming (although I've made games in the past, but not with an engine). The first game I'm making is an exact Space Invaders clone, but I'...
user avatar
1 vote
1 answer
75 views

Set SpriteRenderer tile to extend from a different side

I have a SpriteRenderer that should represent a never-ending tile floor. The idea is that we have a factory floor in an idle game that can grow forever. I got two components: Top part consisting of a ...
user avatar
  • 113
0 votes
0 answers
46 views

How to refer to a saved visual scripting variable in Unity?

I have a AoT Dictionary called AlphabetWidth that I fill with data I generate when my game starts. I mark this variable as "saved", as described here I generate the dictionary data inside ...
user avatar
  • 163
0 votes
1 answer
58 views

Why does the player rotate nonstop?

...
user avatar
0 votes
0 answers
16 views

How to utilize stacking blocks under the player object(cylinder) by using rigidbodies in unity3d?

I am working on a hyper-casual game project which is very similar to Matching Cubes. Initially, I was using transform to stack blocks under my cylinder(player object). But in the game there will be a ...
user avatar
0 votes
1 answer
36 views

Why rotating backwards is too fast, even if I set the time to 3 seconds?

The rotation is very fast. It takes less than a second and for sure not 3 seconds. Maybe it's better to do it without using a coroutine? Or something in the ...
user avatar
0 votes
0 answers
50 views

How to stop the agent when target is unreachable

I want my player characters to stop when the target is unreachable. Please watch this video. As you can see in this video, the agents don't stop when the target is unreachable. This is my code: ...
user avatar
2 votes
1 answer
75 views

How to animate a 2D top-down fish?

Recently I've been trying to create a controllable fish character. The game is 2D and top-down. My two approaches are: Skeletal Animation, which is versatile but looks too robotic. For example, no ...
user avatar
0 votes
1 answer
49 views

Unity coroutine not yielding sometimes

I'm making a 2D platformer controller and I want to implement a coyote time and buffered jump, the way I implement both is by setting a bool to true when either action is enabled like this: ...
user avatar
0 votes
1 answer
22 views

How to reference an object that was not destroyed from a previous scene in the inspector

In a game I'm working on, I have a button on the pause menu that allows me to mute and unmute the background music. The toggle button, in the inspector, references the audio manager object and calls ...
user avatar
0 votes
0 answers
25 views

Unity - How to completely disable auto refresh everywhere (in favor of manually compiling them)

Question: Is it possible for me to create a custom script that will fully disable auto refresh everywhere within Unity (not just on script changes; in my case, asset creation/deletion in addition to ...
user avatar
1 vote
1 answer
30 views

Drawing a filled ellipse in Unity

For my Unity puzzle game, I am looking to draw elliptical "shadows" under certain letters in a Text Mesh Pro text field. These shadows will have varying widths depending on the width of the ...
user avatar
  • 163
0 votes
0 answers
29 views

Sparse voxel octree LOD

I am trying to create a sparse voxel octree in Unity but I am having troubles wrapping my head around how they work. Could anyone explain to me how I can populate an octree with noise-generated points ...
user avatar
  • 1
0 votes
1 answer
37 views

Argument out of Range Exception on click of button that calls a function that doesn't use an index

Currently writing a script that builds a HUD for testing some functions in a project. It automatically builds buttons, one of which works, while the other gives the error indicated in the title and ...
user avatar
1 vote
1 answer
58 views

In Unity 2021.3, is there a way to search my project files for all prefabs that have a specific component attached to them?

If many of my prefabs have an ExampleComponent.cs attached to them, how can I use Unity's built-in search to find them? If such a search isn't possible, what are ...
user avatar
0 votes
1 answer
44 views

Sphere rolling shader like ice cream

now I can make cylinder shape with shader. But what I want to do is like picking up ice cream with an ice cream scoop. How can I do this?
user avatar
0 votes
1 answer
20 views

How to make the transform rotate backwards but in FixedUpdate instead in coroutine?

First time I tried this method: ...
user avatar
0 votes
0 answers
19 views

Playing sounds while animating in Unity

I've wanted the animation to play a sound and instantiate a gameObject when it was at a time I could have done it by using an if to check whether it is at the second I want but I want a faster way of ...
user avatar
-2 votes
0 answers
35 views

How to rotate towards a target but only on the y axis?

I tried this and it's rotating facing to the target but also on the x and i want it to rotate only on the y : ...
user avatar
2 votes
1 answer
38 views

Unity ScrollRect: Pass scrolling through to parent ScrollRect when reaching limits

I have a nested ScrollRect, or more specifically a scrollable list inside one of the items in another scrollable list. Think of it as a scrollable menu with one of the items including a scrollable ...
user avatar
0 votes
0 answers
24 views

How can i use a class for either vector3 or transform in the same variable in a mono script?

I created this class, which is attached to an object with some colliders: ...
user avatar
0 votes
0 answers
24 views

Creating an infinite scrolling background in Unity with Cinemachine

I'm new to Unity, so apologies for any oversight. I have been trying to use the following code to create a parallax effect and an infinite background in Unity. It's from the following video: https://...
user avatar
1 vote
1 answer
19 views

Large Text in Unity Inspector

I'am building a game using the webcam where I have to step back from the screen for testing. Thus I would like to display a single value in the inspector using a larger font. Is there a possibility to ...
user avatar
  • 121
0 votes
0 answers
67 views

Smooth lerp towards a moving target

I stumbled upon this function that lerp towards a moving target with exponential correction which works really well. The original author mentioned integrating the target position. Can anyone explain ...
user avatar
  • 11
0 votes
1 answer
37 views

Why is my character controller deacceleration not working?

I want my player to deaccelerate when he stop not just stop in place. Here is my code: ...
user avatar
  • 127
1 vote
1 answer
38 views

How to get data from a Scriptable Object into a Prefab template

I made a Unity Prefab where about 5 things vary. I then made an invisible GameObject where I use Visual Scripting to hardwire the 5 differing items, in order to create the various GameObjects I need. ...
user avatar
  • 163
0 votes
1 answer
21 views

Testing if instantiated prefab is colliding with environment

I'm trying to generate a number of prefabs in a scene where that scene will have procedurally-generated terrain objects. I have tagged each of the terrain objects with ...
user avatar
  • 1,368
0 votes
0 answers
26 views

How to limit camera rotation angle

I want to rotate my camera horizontally around the object 360 degree and want to limit my vertical rotation from -45 to 45 degrees. I have found some solution over internet but none of them are work ...
user avatar
  • 7
0 votes
0 answers
19 views

CreateWithShader can only be called from the main thread

Note: I encounter a strange problem. I know that as the title suggests I have to create shader/material in main thread but the same code is working with other data without using the main thread. I ...
user avatar
-1 votes
1 answer
43 views

Adding a color picker to a Scriptable Object

I made a Scriptable Object, and added a bunch of fields to it: string, Vector3, Sprite, etc. So far, so good! I'd like to also add a field with a simple color picker in it, that allows me to set the ...
user avatar
  • 163
0 votes
1 answer
20 views

Unity gameObject character stuck in T pose for scene but animations work fine when playing game

I want to put a sword in his hand but it is difficult in that T pose. I have a nice idle animation from Mixamo (model also from Mixamo) that transitions to walk which is working fine. My other model, ...
user avatar
0 votes
1 answer
43 views

Empty room list on region change

I am using PUN2 for my game and I am using the OnRoomListUpdate() function to sync my UI with the rooms that are available to players when they are in the lobby. ...
user avatar
  • 237
0 votes
1 answer
22 views

Raycast collision not working

I've tried to do a gun mechanic for my 3d game but when I tried to write ray cast it didn't work only layer that is printed is 0 even though it shoots and gets stopped by an obstacle here's the ...
user avatar
0 votes
1 answer
65 views

How to detect if hit by raycast from object with name/tag

INTRODUCTION: In unity, I want to make a dynamic, object use system. Where the main player camera shoots a raycast when left mouse button is clicked and if an object that can be used for example a ...
user avatar
  • 169
0 votes
1 answer
45 views

Where did the Composite Collider go?

Some of my GameObjects have 2 Sprites nested under them, like how Cat and Snake are nested under Sprites: The "Cat + Snake" parent GameObject has a Composite Collider 2D and a RigidBody 2D ...
user avatar
  • 163
0 votes
1 answer
38 views

Get all images from folder and set them in a list?

How to Load images from folder and set them in a List? ...
user avatar
  • 509
0 votes
1 answer
9 views

Finding GameObject with Tag, excluding this object and its children

I am new to Unity. I'm trying to create a combat game. I want to access different game objects by tag through the FindGameObjectWithTag method, but I want the ...
user avatar
0 votes
1 answer
34 views

How to execute functions through the console of a running server build

If I mark the "server build" check box in the building settings, build and then run the .exe, the game or in my case the server, will run as console with no graphics. But what if I want for ...
user avatar
0 votes
1 answer
43 views

What are some "clean" ways to go about reusing the same collection of variables?

I have 4 GameObjects, a character controller script, an enemy manager script, and a damage system script that I would reuse for several different situations in the same way for each. Currently I put ...
user avatar
0 votes
0 answers
16 views

Firebase OTP credential verify doesn't work with phone number

I have 2 functions, the first function works correctly. The second one, when I put the OTP and want to verify the code from my SMS it doesn't work, it only creates a user in my Firebase database but ...
user avatar
0 votes
0 answers
16 views

How to display the Composite Collider to a player

I have a GameObject with a Composite Collider on it. There are 2 nested GameObjects under it, each with a Sprite: I am making an educational game, and for pedagogical reasons I'd like to display the ...
user avatar
  • 163
2 votes
2 answers
45 views

Animating a line around an image for Unity app

I would like to animate a line around an image, starting from the top right going clockwise around the image and then show the check mark. The animation should be possibel to stop and restart. There ...
user avatar
  • 153
1 vote
1 answer
56 views

How to make an object move and rotate the same amount as another obejct

INTRO: I am trying to make a camera move around in a fast moving, rotating in all axis, spaceship.... This person has achieved exactly what I need to achieve if that is a good reference for you (go to ...
user avatar
  • 169
0 votes
0 answers
35 views

How to quickly calculate the number of tiles between buildings in a tile system

my friend and I are currently working on a city builder game like Anno/Cities Skylines but with some own ideas and tweaks. (of course, on a much smaller scale) Currently, we are struggling a bit with ...
user avatar
  • 1