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.
16,744 questions
2
votes
0
answers
90
views
How to feed lightmap in GPU instanced meshes in Unity?
Unity's documentation state that GPU Instancing supports baked lighting:
Since Unity 2018.1, Global Illumination (GI) rendering is supported by GPU Instancing in the form of light probes, occlusion ...
0
votes
1
answer
186
views
How do I load assets in a specific scene using Addressables without needing to instantiate anything given a handful of different GameObjects?
I’ve looked at several tutorials regarding Addressables and it seems that loading an asset revolves around referencing it in the inspector, loading it in, and then finally instantiating it but putting ...
1
vote
2
answers
221
views
Why does my character not move together with the moving platform?
I have a game with a player controlled by a CharacterController.
I also have a MovingPlatform.
When the player lands on the moving platform, it becomes a child object of it, so that it should move ...
1
vote
0
answers
148
views
Designing a buff/debuff system in a multiplayer game
I'm new to netcode and game dev and I'd like some input on a multiplayer buff/debuff system I'm working on in Unity, using NGO with a dedicated server. I aim to use a server authoritative architecture ...
0
votes
0
answers
75
views
Inconsistent jump height when rotating character left or right
I am developing an endless runner mobile game, Similar to Subway Surfers. I make my player character rotate slightly left or right and then return to facing forward when sliding left or right. The ...
1
vote
0
answers
31
views
Problem Linking Separately Exported Armor to Character Rig in Unity
I’ve been struggling with export issue between Blender and Unity, and I’d appreciate some help. What I’m Trying to Do: I’ve created a character and a chest armor piece in Blender. Both are rigged to ...
1
vote
0
answers
274
views
Converting a Transform from Unity's Coordinate System to Unreal Engine's
I am trying to convert a transform from the Unity Coordinate System to the Unreal Engine Coordinate System (and others).
Ideally, I want to take a position, rotation (in Euler angles), and a scale as ...
1
vote
1
answer
238
views
how to efficiently find prefabs that are using a script in Unity?
In Unity, is there an efficient way to find all prefabs that are using a specific script component? One easy but inefficient way is to iterate e.g in Bash, all the .prefab files in the project, and ...
1
vote
1
answer
291
views
How should I go about handling multiple phone resolutions from a reference resolution?
I built my entire game in Unity based on my Android phone resolution, both for UI and object sizes. Now, everything looks good for a 1080 x 2400 resolution, but I know that's not the aspect ratio of ...
0
votes
0
answers
45
views
How to save data the most efficient [duplicate]
If I have a lot of data to save, say 500 ints for how many stars a user has collected, some text for user created levels, settings, etc.
What would be the best method to save all of this?
Should I use ...
0
votes
2
answers
263
views
How to Replace Unity's Default Physics Engine (PhysX) with Mujoco?
I am working on a robotics simulation application in Unity. I want to replace the default physics engine, PhysX, with Mujoco. My goal is to enable a toggle within the Unity application to switch ...
0
votes
1
answer
194
views
Automatically setting the parameters based on player's ability
I work on a simple arcade game. The player controls a diver. The diver moves forward at a constant speed. The player can use input controls to move the diver up or down. Along the way, the diver ...
1
vote
1
answer
313
views
Is this code using Awaitable correct?
I am upgrading my code from coroutines to using async-await and Awaitables on Unity 6. I have the following code of a spawner:
...
0
votes
0
answers
76
views
Unity UI Images without a sprite set are invisible when the containing scene is loaded additively
I have a game with several scenes, all loaded using addressables:
A persistent scene that stays loaded with things like the main
camera and certain common game systems.
A lobby scene
A game scene
...
2
votes
1
answer
208
views
Character Keeps Entering and Exiting Trigger on Moving Platform in Unity
I'm developing a character controller in Unity and running into a problem with my character repeatedly entering and exiting a trigger collider on a moving platform. The character should stay within ...
0
votes
1
answer
150
views
Why does my object change its visible size when I rotate the simulator screen?
I have a very simple scene in Unity, with a single object (with a SpriteRenderer). When I view it in the Unity simulator, it looks like this:
When I click "rotate", to rotate the simulator ...
2
votes
1
answer
185
views
How can I use multiple monitors in Unity?
I am trying to work with two monitors; I want to have two cameras in my scene, such that each camera projects to a different monitor. I tried to follow this guide, which says that I have to change the ...
1
vote
0
answers
78
views
Does adjusting the speed of an animation effectively change its frames?
Animations are made up of frames, for example in the below animation it takes Ryu 3 frames to execute his kick, it does damage during the next 12 frames, and finally takes him 17 frames to recover.
...
2
votes
0
answers
246
views
Small sprites in Unity look pixelated, and need anti-aliasing
I've got a sprite in-game (using a Sprite Renderer) that was drawn by our artist at a very high resolution, but in-game can appear quite small on-screen:
My boss has been complaining that the ...
0
votes
1
answer
287
views
How to control the scaling/cropping of a background image
I created a new scene in Unity, dragged an image file, and scaled it to fit the screen size. Here is how it looks like in the Scene panel:
When I change the screen size, e.g. by switching to ...
0
votes
0
answers
62
views
Making Unity Particle System emission rate scale with Sprite "area"?
I'm using a Particle System with the Shape in the shape module set to Sprite Renderer, and the Type set to Triangle.
As far as I can tell, the default behavior is for the Particle System's emission ...
0
votes
0
answers
61
views
ParticleSystem freezes the game on first instantiation
I have a simple class with a ParticleSystem prefab:
public class ParticleEffects : MonoBehaviour
{
[SerializeField] public ParticleSystem starExplosion;
}
And ...
1
vote
0
answers
51
views
0
votes
0
answers
108
views
Stickfight the Game Ragdoll Physics
I'm trying to make an active ragdoll in Unity 2D. The problem is that when you see mine as compared to Stickfight the Game or Off the Sticks, mine is very stiff and "janky". I just don't see ...
0
votes
1
answer
85
views
How to detect collisions between objects in a centralized game script?
Consider a game script that has an array of prefabs:
[SerializeField] List<Cat> cats;
Another script in the scene has created wall objects, which are ...
0
votes
1
answer
62
views
Cannot resolve symbol 'detectCollisions' on Rigidbody2D
I'm simply trying to disable collisions for a Rigidbody2D:
rb.isKinematic = true;
rb.detectCollisions = false;
as per: https://...
1
vote
0
answers
151
views
Graphics DrawMesh/RenderMesh Instanced don't work
In the following code, I try to draw a mesh using 4 different methods:
DrawMesh and RenderMesh both do work
DrawMeshInstanced and RenderMeshInstanced both don't work
Code:
...
0
votes
1
answer
154
views
Light dissapear when baking in Unity
I am playing around with Unity and lighting is proving to be the most nerve racking thing about it so far.
I think I understand the types of light and pros and cons of bake vs realtime but when I do ...
0
votes
0
answers
158
views
Browser memory increasing the longer Unity WebGL build runs
I have an app in Unity WebGL that should run for a long time (a few days) without stopping. One issue I notice is that, the longer the app runs the browser memory usage gets bigger. Is this related to ...
0
votes
0
answers
340
views
Teardown Voxel Physics
If we assume that Teardown was made in Unity, how would it be made in a high-level way?
See the game here. I tried some things like breaking each shape down into small voxels, but how do you determine ...
0
votes
0
answers
39
views
Adjusting Minimap Camera Viewport Indicator to Account for Occlusion of Camera by UI
I am working on a 2D RTS game in Unity. One thing I want to represent is a minimap indicator that shows the camera's viewport. I got it working, but it doesn't reflect how the camera is occluded by ...
1
vote
1
answer
176
views
AR Apps showing Black screen in Unity
I am creating an AR app in Unity3D using AR Foundation and Google ARCore. I set up all the necessary configurations, created the build, and installed it on an Android device. The app runs, but it only ...
0
votes
0
answers
106
views
Merging sprites to be used as a single tile
I am attempting to make a CompositeTile out of 4 sprites (one for each corner of the tile) that can be used as a single Tile ...
0
votes
0
answers
127
views
Unable to play animation from another layer
I'm attempting to play an animation from different layers but having some difficulty. I'm trying to play animation transitions in one layer and then go back to the base layer to play an animation ...
1
vote
2
answers
277
views
How to make ball rotation in billiard look more natural?
I'm working on a billiard game in Unity (2D), where I used 3D sphere visually and I'm trying to make the ball's rotation look natural as it moves across the table or hit another. I've got the ball ...
0
votes
1
answer
80
views
Match mainCamera and SceneView camera when hit play
I have a simple yet difficult task. When you hit play in Unity game camera should match camera in scene view. It should be done once not constantly.
This show zeros uniti I switch to sceneview in ...
1
vote
1
answer
141
views
Why do I see a wireframe when rendering with conservative rasterization and disabled Z writes?
I wrote a shader that implements most ShaderLab commands:
Rendering without anything fancy:
After enabling conservative rasterization:
After disabling Z write:
Ironically, that's exactly what I ...
1
vote
1
answer
453
views
Unity UI toolkit button callbacks don't work if I disable the UI document and then enable it again
I have a camera setup and I want to display a UI on it. I got a basic UI using UI toolkit shown below:
So I have a keyboard button setup so that when the button is pressed a boolean toggles and turns ...
0
votes
1
answer
201
views
How Can I programatically identify a Material in Unity?
I have some gameobjects that in some conditions have an additional material added to them programatically at runtime.
I then later want to be able to remove that specific material. How can I identify ...
0
votes
0
answers
117
views
How to project textures on to the mesh and overlap them like in Let’s Play Pottery?
I want to learn how to project textures on to the mesh and overlap them like in Let’s Play Pottery. I have an idea for game. I created Models, 3d viewer but I can’t figure out how to implement texture ...
1
vote
0
answers
91
views
Is it possible for scenes to be addressables?
I would like to load scenes via asset references, just like other assets.
But SceneAsset belongs to the UnityEditor namespace, ...
0
votes
1
answer
353
views
How to join skirt to LOD terrain mesh chunk to ensure it matches at seams?
I am exporting my Unity terrain to a mesh. Because the terrain is big, I also split it into multiple chunks.
Moreover, I also generate chunk LODs. I enable a certain chunk LOD in-game based on the ...
1
vote
1
answer
110
views
Update Unity Leaderboard Metadata Without New Score
I’m using Unity’s built-in Leaderboards for my game. I want to be able to change the metadata attached to a player so they can change teams, but ...
3
votes
2
answers
1k
views
Rendering transparent UI in Linear Color Space
As you may know, Unity can have issues correctly rendering transparent 2D Sprites/Textures exported from Photoshop or Figma. Reason being that most of these tools operate in Gamma color space while ...
0
votes
1
answer
87
views
Coins Not Moving to Canvas Position When Camera Moves
I am currently developing a 2D game in Unity, and I'm having an issue with moving coins to a specific position in the UI Canvas when they are spawned. I want the coins to animate from their spawn ...
0
votes
0
answers
128
views
Find Shader error source without source line
I have joined a new project and encountered an error:
Edit:
Here is the text error.
Property (_MainTex) already exists. Use SetTexture instead.
As you can see it ...
1
vote
1
answer
201
views
Communicating between Components and systems: ScriptableObject vs MonoBehavior vs Events
could you please guide me or help with sane architecture basics in Unity?
I'm making a tower defense game and I'd like to have modular approach without using frameworks, so no ECS/DOTS/SOAP
I want to ...
0
votes
1
answer
63
views
ForceMode2D.Impulse not appliying force to the sides
I've spent hours trying to find the problem with this:
...
1
vote
0
answers
123
views
How to Check if a ScriptableObject is Null or Contains Data in Unity Visual Scripting?
In Unity Visual Scripting, I'd like to check to check if a Scriptable Object has data in it or not. So to do that, I tried using a Null Check node on the data directly:
You can clearly see that there'...
1
vote
1
answer
154
views
How to prioritize and display correct UI for multiple actions triggered by the same input?
In my Unity game, the "Interact" action is used for multiple tasks like opening doors and grabbing/dropping objects. However, there are scenarios where the player has an object in their ...