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
0
votes
0
answers
35
views
Why does the output of GUI.DrawTexture jitter in the SceneView when I scale it?
I am trying to draw an icon using GUI.DrawTexture at a world-space position iconPos to represent a sun icon.
It worked, but when ...
1
vote
1
answer
60
views
Applying localScale to elements in a verticalLayoutGroup with a gridLayout subgroup
I have a few elements inside a verticalLayoutGroup. To better visualize which one is selected, I would like to scale all other elements to 75% of their size and keep the current one as it is.
This ...
0
votes
0
answers
54
views
How to solve the issue in an HD-2D style Unity game where the upper part of the player’s sprite clips into the 3d wall when standing close to it?
I am making an Octopath Traveler like game.
I want the player to lean against a wall, but because the player’s sprite is angled while the wall is vertical, the player’s feet touch the wall while the ...
0
votes
1
answer
67
views
How to program era-switching in an endless runner?
I'm using Unity's built-in 3D render pipeline, not the HD one. My extent of programming knowledge is basically whatever the learn.unity site provides. I decided my first game to make was going to be ...
1
vote
1
answer
63
views
Unity HDRP custom pass stencil buffer not working in build mode
I've been attempting to create this stencil/mask buffer using Unity's HDRP C# Custom Pass feature and I've been having trouble getting it to work ONLY in build mode. Here is my code:
In my ...
2
votes
2
answers
980
views
Is it worthwhile to use events when there’s only one subscriber?
I'm trying to determine the best architectural approach for handling communication in Unity, specifically when the interaction is strictly one-to-one.
The Core Design Conflict
I have five crucial, ...
0
votes
1
answer
56
views
Draw calls within SRP Batch
I noticed after I made a minimap for my 2d strategy game that there was significant lag - only to realize that every single hex is getting its own draw call/batch. I've been messing around for about a ...
12
votes
1
answer
2k
views
Destroying the parent when all children are destroyed
I have a spell system where a the spell is a self-contained game object handling all the logic. When done, it destroys itself. This works great
Then I added a second game object handling animation, ...
1
vote
1
answer
80
views
Is there a "best practice" for making changes to packages
This could be answered from a perspective of Unity dev, or generically for programming - either would be beneficial.
I'm working on a game and am using two packages, More Mountains' TopDownEngine (for ...
1
vote
1
answer
69
views
Sign out of Google Play Services through code
In the Unity engine, I am using GPGS as a token to log in via Google sign-in. It works, but now I have another issue:
As of the last update of the SDK 2.1., this method in PGS for Unity is deprecated:
...
3
votes
1
answer
168
views
What’s the correct / idiomatic way to pause a game in Unity?
I'm trying to implement a robust pause system in Unity and I'm confused about the correct approach. My first (very simple) implementation in my previous project used a ...
1
vote
1
answer
66
views
Animation can't disable gameobject
I'm using a very basic animation to create a transition, which involves deactivating a gameobject on the last keyframe.
Goal:
The ChangeRound animation is about 1 second long. It enables the UI image ...
0
votes
3
answers
163
views
How do big open worlds handle Object Pooling?
Object pools are great. They are fun to make, save you a lot of memory and fps.
But as my projects grow in size and complexity it gets harder and harder to work with them. If you only have a couple of ...
1
vote
1
answer
52
views
Can't get a Prefab to scale down accordingly inside a Container
I have a prefab with some fixed sizes on itself and its elements:
Then added a Aspect Ratio Fitter and a Preferred Height:
.
When using that prefab from a container with Horizontal Layout Group with ...
0
votes
2
answers
119
views
When should an object with a collider have a rigidbody?
I had some questions about Physics / Rigidbody in Unity.
I have a 2D sprite with a collider. The 2D sprite is simply a card that I place on a table with the mouse. I use the collider for raycasting (...
0
votes
2
answers
125
views
Why is my rigidbody not moving when I press the buttons? I can't see any reason it shouldn't
The "Car" in question is a plane. The question is pretty self explanatory.
Here's the Car in the Hierarchy:
Here's the car in the inspector:
And here's the PlayerMovement script:
...
0
votes
1
answer
86
views
Can PNG format be used for alpha channel-packing for URP shader in Unity engine?
Note: I intend to use only the Inspector window to use all textures, not Shader Graph or Nodes or any custom scripts. Also I might use some technical terms incorrectly by mistake, as I'm not much ...
1
vote
1
answer
90
views
Drawing textures to a RenderTexture + rotating in 90° intervals
For context: I am currently working on a BepInEx Plugin for the Unity-based game Hollow Knight: Silksong. The goal is to be able to replace the base game sprites with custom ones. The game uses Sprite ...
0
votes
1
answer
69
views
Rendering Sprite from tightly packed atlas onto RenderTexture
I'm currently working on a Unity BepInEx Plugin that should allow users to customize certain textures in the game. As part of this, I need to extract sprites from a sprite atlas into individual ...
1
vote
1
answer
101
views
Is there a way in Unity to detect which gameobjects are making it take longer to enter/exit play mode?
I have a scene with quite a few gameobjects in it and for the first time since using Unity, when I enter/exit play mode (or even close and reopen the scene) it takes about a minute to complete this. ...
0
votes
2
answers
87
views
How would I make a "slideshow" cutscene?
I'm making a 2D game using Unity and I want to implement cutscenes that change over at certain lines.
...
2
votes
1
answer
106
views
Can't Get Unity New Input System To Work
For context I am very much a beginner.
I have been trying to get the player to move using Unity's new Input System following this tutorial. It's only a year old and others in the comments seemed to ...
0
votes
0
answers
116
views
How is 2.5D achieved with 3D Objects in a 2D scene?
I would like to make a 2d top down scene with 3d Objects. I could make a 3D scene and just tilt the camera 45 degrees on X and that would give me basically the same thing(I think). But I started with ...
1
vote
0
answers
29
views
Halftoning Multipass HDRP Unity
I am pretty new to rendering, and I wanted to add a black and white halftone effect. I wrote the two shaders and created the materials (pass 0 to create mask and pass 1 to mix it with the scene). They ...
0
votes
0
answers
89
views
FPS improves when parents of skinned AI are disabled before play, but not when disabling them during play
I am playing a scene in Unity editor. If I play the whole scene, the FPS is 125.
Next, there are 2 test cases.
Case 1: If I disable some big game objects first, and then play the scene, the FPS is ...
7
votes
3
answers
4k
views
Is it possible to directly check for source code modification
I'm looking for a better way to actually detect "cheats" by checking if the source code of my game has been modified and if any code has been injected to the original code in C#.
The issue ...
4
votes
3
answers
3k
views
How to avoid cycles when one character stat can be enhanced by another?
I am creating an ability system in Unity and it is currently able to update base values of stats and keep track of persistent buffs/debuffs while taking operation order into account (Add, Increase, ...
0
votes
0
answers
184
views
Terrain vs mesh : which one is better in terms of performance and storage size?
I have heard many conflicting opinions about the pros and cons of using terrain vs mesh in Unity. Some people say that terrain has better performance while others say mesh does. So, I am not sure ...
2
votes
0
answers
106
views
How to fix LOD cracks with Marching Cubes?
I'm creating voxel planets using Marching Cubes (MC). To handle nearby (high-resolution) and distant (low-resolution) blocks, I use an Octree data structure.
NOTE: The implementation uses compute ...
2
votes
0
answers
64
views
How can I disable the built-in gyro control in Cardboard VR?
When I create a project in Unity, enable Google Cardboard VR support, and build a project on Android, the camera is controlled by a gyroscope, although I did not write any controllers.
Even if I ...
0
votes
1
answer
43
views
Transform is not available in SystemBase Script (Unity Entities)
My player is baked entity in subscene while main camera is outside on scene. For some reason system cannot find transform of camera, GameObject was found though.
<...
0
votes
1
answer
82
views
Where is UnityFramework.framework located in unity xcode exported Project
I want to use Unity as a library for iOS platform. I exported the build from Unity for iOS. But I am unable to locate UnityFrmework.Framework. Is there any step i am missing?
Unity Docs states that: ...
0
votes
0
answers
47
views
Static event not working on scene reload(SceneManager.LoadScene();)
(Maybe good to know, this game is part of a game dev course where we had to make a Vampire Survivors like game)
I thought SceneManager.LoadScene() reloaded EVERYTHING in a scene, like a clean state, ...
3
votes
0
answers
150
views
Displaying pixel art at any resolution with subpixel movement
The Goal
I have a game in Unity which utilizes pixel art. I'm not following the standard rules of pixel art, however. I'm ok with sprites having different sized pixels, pixels rotating, and pixels not ...
-1
votes
1
answer
127
views
How can I implement a fish character with a “chargeable tail” mechanic
I’m trying to replicate the fish physics from Fish Volleyball.
If you want you can try demo of the game or watch video preview
The unique part is that the fish doesn’t jump normally — instead, when it ...
0
votes
1
answer
54
views
How to Render Moon Phases from a Texture2D in Unity Using a Script?
I have a Texture2D of the Moon, and I want to render different moon phases so that it visually matches the examples shown here Celestial Programming : Moon Phase Image Rendering, I've tried several ...
0
votes
1
answer
66
views
Does SceneManager.LoadAsync(name) load the whole asset or only the prefab?
I have an asset called "Ocean" that contains 100 fish, and one of the prefabs for these fish is called "Dolphin".
My game has 100 scenes, and each scene contains 1 different fish ...
1
vote
1
answer
74
views
Change sprites for multiple image in one function
I am trying to make a digital clock (24:00 type), where each number is an individual image, that should change. So, I want to change sprites for multiple images in one piece of code.
But when I ...
0
votes
1
answer
130
views
Mipmaps and LOD Behavior in Skybox Shaders
Is it beneficial to use Generate Mipmaps for a texture used in a skybox shader?
I need to use tex2Dlod to fix the edge seams ...
0
votes
1
answer
112
views
OnTriggerEnter called without a Rigidbody
I use Unity and the player controller in the game is acting strangely. It has a Character Controller but no Rigidbody. I use CharacterController.Move to make him ...
0
votes
0
answers
122
views
Why does this code behave strangely with different camera angles?
Relevant to this issue are two MonoBehaviour scripts: Actor and Player. ...
1
vote
0
answers
48
views
Camera is skipping frames after turning a little bit
I'm observing that when I move the camera a little bit it works normally, but if I move more then I'll skip chunks of the screen.
I enabled "press CTRL twice to show cursor" with Powertoys ...
1
vote
0
answers
98
views
using Unity URP/lit shader with skinning and DOTS
I'm using:
Unity: 6000.0.51f1
Entities: 1.3.14
Entities Graphics: 1.3.2
URP: 17.0.4
Shader Graph: 17.0.4
I'm fairly new to both DOTS and Shaders, but when trying to use DOTS with URP combined with ...
0
votes
1
answer
122
views
URP Maximum Sample Index (16) with Light Cookie Input
I just recently imported a new asset package, all of the materials use the URP lit shader, no custom shaders. However, now I can't build the game because I keep getting the same errors:
...
1
vote
1
answer
97
views
Why does dynamic light flicker/get replaced with a square when rotating the camera?
I am facing the same problem over and over again with Dynamic Lights in Unity and don't know where next to look. I am still learning Unity so maybe I'm missing something trivial because it happens in ...
0
votes
1
answer
105
views
Color is changing in multiplayer without explicit syncing
In netcode for GameObject, network object script is used to make it networkable which means if the object instantaited it will appear on all clients. Network Transform allow you to sync the transform ...
0
votes
2
answers
121
views
Camera Snapping instead of panning
I am trying to make a camera system for a 2D platformer, with three camera modes to begin with:
Follow, normally following the player
Horizontal: Y is set, X follows player
Static: Locked to a certain ...
1
vote
0
answers
64
views
How can I dynamically make a distance field shape of the lit part of the moon to use it as a halo in a custom skybox shader?
I created a custom skybox shader featuring a black sky with only the moon and its halo. The moon responds realistically to the scene’s directional light (sunlight), which creates a convincing effect. ...
0
votes
2
answers
87
views
UI tween animation completely different on Phone and in Unity Editor
I have this function that spawns an Icon from a world position and animates it to correct UI position. In editor it works fine but in apk on phone it has a wrong starting position. Now as I understand ...
1
vote
2
answers
520
views
How do I implement the "collide and slide" algorithm in Unity?
I've recently been attempting (and failing) to create my own character controller for my 3D Unity game for around a week. I hate the Unity rigidbody physics system for making a character controller, ...