All Questions
16,744 questions
4
votes
1
answer
1k
views
Game built uses a lot of GPU processing, in the editor uses very little
I am building my project in Unity 2018.2.21f1 for Windows in architecture x86_64, with:
Copy PDB files | false
Create Visual Studio Solution | false
Develoment Build | false
Autoconnector Profile | ...
4
votes
1
answer
2k
views
What is the most appropriate way to achieve synchronous Addressable asset loading?
I am transitioning my project from Resources to Addressables. Some parts of my game just aren't worth doing asynchronously, and ...
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
1
answer
2k
views
Unity app crashes when using unmodified custom Android manifest (didn't find class "UnityPlayerActivity")
Note: I find/replaced my actual company name with 'companyname' below for anonymity, it's not the actual package name I am using.
I have Unity 2018.4.11f1 LTS and the platform I'm having issues with ...
0
votes
0
answers
56
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 ...
0
votes
3
answers
694
views
AI Algorithm to make enemy smarter from level to level in Runner game
I am designing a City-Runner game in Unity 3D Engine.I am a beginner in game development (not in programming). The idea is really simple, the Runner will be followed by AI enemies, and if caught by ...
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 ...
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 ...
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:
...
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
1k
views
Navigate UI with Dpad from Xbox controller on Mac?
So, according to some documentation I found, the Xbox controller on Mac does not return Dpad presses as vertical/horizontal axes:
As you can see, the Dpad is only recognized as buttons 5, 6, 7, and 8, ...
2
votes
2
answers
981
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, ...
2
votes
1
answer
2k
views
Smooth+Flat shaded meshes cause shadow artifacts (understanding the source of the problem)
I'm using blender to create assets to use in Unity3D, and I'm having some trouble understanding how the smooth/flat shading interacts with shadows, I'm sorry if it has been asked before, but all the "...
1
vote
2
answers
2k
views
Hold touch at the screen to move object
I'm using unity2D and C#, and I have a code for touch screen:
...
0
votes
1
answer
2k
views
Stop 2D platformer character from sliding down slope
I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics.
Here is the code I use for the player movement:
...
0
votes
1
answer
1k
views
Unity baked light messes up a set of objects
On a few objects I use a technique where instead of using geometry, I place planes with a Cutout Material on top of each other, creating a 3D illusion with minimal cost. The thing is, it looks great ...
3
votes
2
answers
1k
views
Efficient 2D grid overlay on tiles without each cell being its own GameObject
So for my game I need the ability to add a grid overlay over my tilemap. Now I don't think that making the grid with each cell being its own GameObject with some SpriteRenderer would be hard to do but ...
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 ...
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
4
answers
2k
views
How to make TextMeshProUGUI truncate the left part (beginning) of a line?
I'm trying to display file names including their directory. When the file path gets too long for the text box, I want to align it right, because the filename is more important than the directory.
I ...
5
votes
2
answers
8k
views
How can I get Unity to do letterbox/pillarbox to maintain aspect ratio?
I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ...
4
votes
1
answer
2k
views
Changing scene while joining room and RPC buffer problem
I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the ...
2
votes
2
answers
375
views
How to make the player pass through only certain objects, but not others?
Experimenting with my 1st Unity project. It's about a top down swimmer. By toggling the swimmer's collider, he can swim under boats:
...
1
vote
1
answer
5k
views
Issues using NetworkServer.Spawn with Unity and Mirror-Networking
I am using Mirror to handle the networking aspect
When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.
...
0
votes
1
answer
515
views
Equivalent to ini files for parsing external data in Unity
I'm moving from an old game dev tool to Unity, and wondering how to go about handling external data files.
In my previous program I'd set up external (txt/ini) files like this:
...
0
votes
2
answers
460
views
Render Texture is rotated 90 degrees when applied to object imported from Blender
I'm new to Unity and am trying to create a sort of CRT computer monitor/terminal with text. To draw the text, I set up a Text Mesh Pro with its own camera, which renders to a Render Texture.
I then ...
2
votes
3
answers
4k
views
Is it better to create a scene in blender or in Unity?
First of all, I am really new to all of this.
It's really confusing me whether it's better to:
create a scene and then import it into Unity,
or just create objects like characters, chairs, etc. in ...
3
votes
1
answer
834
views
How to prevent Unity from generating unnecessary changes after saving a scene with no actual changes
I was having trouble where Git shows a lot of changes (for my case, about ~3000 diff change since I have many objects in the scene) after saving a scene (.unity file) in Unity, even though there are ...
0
votes
1
answer
2k
views
How to create a line renderer with end point as the mouse position, but with a fixed direction
I have two objects with a line going from one to the other, like this:
I want to create another line with a starting point one of the objects and an end point the mouse position, however still facing ...
0
votes
1
answer
653
views
Tetris block kinematic rigidbodies pass through one another with Transform.Translate
I am trying to build a Tetris 3D game in Unity but I am stuck at getting the different blocks to interact (to detect each other, to sit one on top of the other rather than going through each other). I ...
2
votes
2
answers
2k
views
How to prevent Unity's ScrollRect from moving as the size of the content changes?
I'm writing a Text-RPG and I have set up a ScrollRect where new paragraphs and choices are added and removed at every turn. This makes the size of the Content change constantly, which I handle with a ...
0
votes
1
answer
1k
views
DrawMesh() not working as intended in Unity
I rendered some UV unwrapped raw mesh data using a special shader, and Graphics.DrawMesh() to a render texture, but upon inspection the data is wrong (world normal and position).
Left is a vanilla ...
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
1
answer
1k
views
Make an arrow to point at a direction from UI
I want to have a guiding arrow on the left side of UI. The arrow is child of the player's camera and it's rendered from another camera into render texture. The render texture is displayed on the ...
0
votes
1
answer
1k
views
Rotating character for 2.5D platformer in Unity
I'm currently making a prototype for a college project in Unity. The game is a 2.5D platformer, though I've incorporated a script for the camera from a 2D platformer so the camera moves ahead of the ...
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
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
1
answer
4k
views
Collision Player and Tilemap Unity
i am a student in austria. I am working on a project for school, where we have to make our own first game with unity. Because it is the first time using unity, i constantly run against problems. Most ...
2
votes
2
answers
1k
views
Unity Animation Curve to change value over time
I am trying to learn how to use AnimationCurve to change a float value over time.
However i am not really sure how to do it
Say i have the following class:
...
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
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
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 ...
0
votes
1
answer
1k
views
Trying to define a custom Composite to the new Unity Input System but failing somewhere
I'm following the "Touch Samples" sample project that comes with the "input system" package.
In one of the sample scene, there is a script that defines a custom composite Binding (for example the 2D ...
0
votes
2
answers
1k
views
How to spawn card sprite
I have a card sprite that I would like to spawn at a specific transform position but can't get anything to appear
My Code -
...
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
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 ...
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. ...