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
49
views
localPosition for UI object gives different results from its values in the script
Here is my script for opening animation. It basically sets the localPosition of an object out of the screen and then brings back in smoothly. The problem is I got ...
0
votes
0
answers
31
views
Unable to join NavMeshSurfaces for different floor areas
In Unity 6, I have a NavMeshSurface attached to a floor with other items as NavMeshObstacles and this seems fine.
The problem is,...
0
votes
0
answers
71
views
Making a slingshot inspired launch mechanism to hit arbitrary point on edge not just fling straight through center of mass
In a 3D world, I have a hockey puck-like body.
I have made a mechanic where I can launch the puck with a slingshot mechanism.
But the point of contact is determined with a raycast and the "sling ...
0
votes
0
answers
128
views
Unable to determine cause of memory leak in Unity when using Addressables. Can anyone give suggestions on what the cause might be?
I'm creating a simple bullet hell game for Android and I ran into an issue when diagnosing my game using the Memory Profiler where memory usage was increasing after each play-through. I had calls to ...
0
votes
1
answer
58
views
Did they change how Player Input SendMessage works when sending messages?
When I first used it I remembered it as always calling the specific method once. So if I created a Jump Action with the key binding of space using SendMessage:
and then created a method for it:
...
0
votes
1
answer
121
views
How to post-process local cameras differently?
In Unity 6, there are multiple options for post processing, but I have been unable after many tutorials and AI advice and the Unity docs, and also installing free packages and removing them and ...
0
votes
0
answers
32
views
What's wrong with this ground check in my HSM?
I'm working on a third person platformer. The player controller uses a hierarchical state machine taken from this video : https://www.youtube.com/watch?v=OtUKsjPWzO8
Using Unity 6.0.
Currently, it's ...
0
votes
0
answers
58
views
Moving an object up to the edge of the screen in 3d space
I'm trying to put an object at the edge of the screen. I can get the edge and center of the camera converted to 3D space easily enough, however, I'm having difficulty with the dimensions of the object....
0
votes
1
answer
71
views
How to Remove an extra line at the top of a CustomPropertyDrawer List?
My first CustomPropertyDrawer fits on a single line, but...
The Colorband List is putting it on a new line, wasting a lot of space.
I couldn't find anything in the EditorGUILayout specifications or on ...
0
votes
1
answer
118
views
Teleport to random point behind Camera and within boundaries
I'm creating a third person game with companions following the player. The companions have a mechanic in which if they are too far away from the player and out of camera view, they'll be teleported ...
1
vote
0
answers
214
views
How to lock the cursor in its current position in Unity?
I want to implement a panning system, and people said to me that the cursor should be locked in place during the panning.
However in Unity all I could find is setting the ...
4
votes
1
answer
922
views
Is it bad practice to frequently write to `PlayerPrefs` in Unity?
Suppose you were making a game in Unity and one part of the game was to store a high score, just stored as an integer.
One could store the high score in Unity's ...
2
votes
1
answer
121
views
Second URP Lit material shows pink on FBX model exported from Unreal 5
I'm trying to get materials working on a model imported into Unity 6, from Unreal Engine 5, but for some reason one of them isn't showing. I have played around with a few of the settings with no ...
0
votes
0
answers
31
views
Animation/Animator based Unity standard shader flipbook
I a making a display with various messages prerecorded in a texture in a restricted environment I am not in control for Unity 2022.3.22f1. This is technically a flipbook which is animated differently.
...
1
vote
0
answers
84
views
'You already own this item' Error for consumable items, Immediately after reconnecting Internet for Unity IAP (v4.12.2) and Google Billing (v6.2.1):
Question:
I’m facing an issue with in-app purchases (IAP) in Unity, specifically when using Unity version 2022.3.55f1, Unity In-App Purchasing v4.12.2, and Google Billing v6.2.1 for a consumable ...
0
votes
0
answers
39
views
Unity continuous collision jitter issue
I have about 100 circle colliders set to dynamic/continuous. They're all being dropped into a "hopper" at the start of the level.
I've noticed that this is:
A) Tremendously expensive (as I ...
0
votes
0
answers
42
views
How can I detect which slice of the pie chart my mouse is hovering over?
I'm trying to create a simple pie chart for my game (a strategy/simulation game) to show population demographic data for a province, but I'm struggling to figure out how to detect which slice is being ...
1
vote
0
answers
128
views
Using 2D diagonal wall tiles in a 3D world with an orthographic camera
I'm working on a 2D game in Unity where the world is 3D and I have an orthographic camera pointed 45 degs to make it look 2D. I'm using the method here to fix the distortion that occurs.
My question ...
0
votes
0
answers
45
views
Player's speed staying constant
I'm having a problem with the code below. My player is always moving at the same speed. Even if I give my boast variable a very small value, the speed remains same ...
0
votes
1
answer
54
views
How to prevent button drift (despite anchoring) when resizing game window?
My Unity game has graphics designed for aspect ratios of 16:9, 16:10, 4:3, 3:2, and 19.5:9. This worked for mobile. But now I want to create a PC version for Steam, and I have to deal with the user ...
1
vote
1
answer
155
views
How do I render a sector (pie/cake slice) of a circular Unity 2D GameObject?
I have a circular GameObject in Unity 2D with a SpriteRenderer attached.
I want to attach a custom component to my ...
0
votes
1
answer
70
views
Unity FromJson Utility Not Populating Instance of Class
I've used FromJson in Unity/C# a dozen times, and yet for some reason I cannot figure out why this one's not working.
Here's the code that does the parsing:
...
1
vote
0
answers
118
views
Why are my Addressables working for PC Standalone build but not Android?
I have a CCD pipeline set up using Addressables and they seem to load perfectly fine from Unity's CCD buckets but when I build for Android and test on my mobile device, it leads to a 400 error.
Here ...
0
votes
0
answers
67
views
Why does burst in Unity particle system work in delay?
How to make it so that when using burst there are no seams between cycles of its spawning?
The burst cycle should start at the beginning of the system cycle, i.e. at 0
Demonstration of the problem
...
0
votes
1
answer
126
views
Materials created from JPG images not working for new Universal 2D project with URP pre-configured 2D Renderer
I have Unity version 6000.0.30f1, and I've started a new 2D project with the option Universal 2D - ...
0
votes
1
answer
220
views
Making 3D maps with 2d tiles for a top down game in Unity
I'm working on a 3d game in unity that looks 2d from having an orthographic camera and 2d sprites, similar to Enter the Gungeon (https://twitter.com/dodgerollgames/status/593625936131653632?lang=en).
...
0
votes
1
answer
228
views
3D Dark Souls lock-on code: Player moves around target in a spiral, not perfect circle
I'm working on a 3D game in Unity that requires lock-on, or Z, targeting found in games like Dark Souls and Legend of Zelda: Ocarina of Time.
The code that I have achieves my intended goals fairly ...
1
vote
0
answers
53
views
How to smoothly blend a 3D rotation which is exactly 180° in Unity?
I have a player capsule which I want to face the same cardinal direction as the key pressed. For example, pressing W will make the player face the camera's current ...
1
vote
1
answer
703
views
Why don't more top-down 3D games use an oblique projection, instead of tilting their models and sprites?
I'm making a 2D game in Unity that is set-up in 3D similarly to Enter the Gungeon, where I have an orthographic camera rotated 45 degrees. This makes sprites look wrong and I've seen two main ways to ...
0
votes
1
answer
109
views
How to make movement relative to player rotation using Rigidbody.AddForce() in 3D Unity?
I'm making a 3D game and I was trying to make movement relative to player rotation for several hours, but I failed. Here's the code, maybe I made a mistake there. Also, player doesn't rotate.
...
1
vote
0
answers
27
views
How can I fix this display error with my custom DCPU-16 for Unity?
I’m trying to recreate the DCPU-16 for Unity that has a console and can render the output to a TMPro text on a canvas. What the code should do is display A B C onto the TMPro text, but nothing appears....
0
votes
1
answer
162
views
UV offset moves over time that can change speed
In Unity, using URP/Shader Graph, I have a peculiar problem. I have a warp tunnel that has a texture and a shader "animation" to make it appear as if the player is moving forward through it. ...
0
votes
1
answer
93
views
Assigning action without creating closure
I am trying to create a system for daily events in Unity, but I am facing an obstacle where performance and memory are very sensitive for me,The DailyEvent consists of a list of DailyEventAction, ...
0
votes
2
answers
276
views
How do I synchronize thousands of game object transforms?
I'm trying to synchronize 3-4 thousand game objects' positions and rotations. I need performance for my Unity game to remain relatively high (30+fps) and to keep the amount of data sent as low as ...
1
vote
0
answers
39
views
How to add a simple extra shader effect in Unity's URP in code
I would like to be able to add certain simple graphical effects to objects in my game. For example, I want dead enemies to fade out, I want enemies that get hit to flash white, all easy stuff.
So far ...
0
votes
0
answers
32
views
When connecting a Character Controller component to a character, it starts to rotate uncontrollably
When connecting a Character Controller component to the character in Unity, it starts to rotate uncontrollably. Without the Character Controller, everything works fine, but the character does not walk....
0
votes
0
answers
130
views
Is it possible to create a blendshape in Unity?
I have a character and I would like to add a simple blink animation to it. But the trouble is that the character doesn't have any bones controlling it's eyelids, and there are no existing blenshapes ...
0
votes
0
answers
38
views
How to design the animation system for part-customizable robot in Unity?
I'm using Unity to build a game, where players can customize their robots with different parts of a variety of sizes and lenghts.
For example, players can put a pair of very long legs with an average ...
0
votes
0
answers
81
views
Wheel collider making my car jump in Unity
I’m making a racing game in Unity and every time the car touches the ground, it just jumps. I’ve seen people complaining about it multiple times, but usually adding mass of about 2000 to the car or ...
0
votes
0
answers
183
views
Moving SplineAnimate Objects Over Time With Proportional Speed
What I'm doing
I'm using Unity's Spline package and I'm trying to move SplineAnimate objects across a Spline, similar to a racing game's mini-map UI.
...
0
votes
0
answers
44
views
Is it possible to create a prefab/variant with a different gameobject hierarchy?
I have a model which has many different parts as children gameobjects. If I select the model in the project view I can change all of the materials (incl children) in the materials tab in the inspector,...
0
votes
1
answer
82
views
Scriptable object lists influencing each other?
I have 2 scriptable object inventories; one acts as the starting inventory and the other acts as the current one. I add objects to the current inventory but I set it's values to the starting inventory ...
0
votes
0
answers
56
views
Unity Editor Api for scriptable object apply on Edit Mode
So i want to design an editor which has the following requirements.
Suppose i already have a prefab called Player.prefab and script attached as Player.cs
And have a scriptable object called ...
2
votes
1
answer
237
views
How can I instantiate prefabs from a non-MonoBehaviour script?
I'm trying to instantiate prefabs in Unity, but I want to do it from a script that doesn't inherit from MonoBehaviour.
I understand that a ...
1
vote
1
answer
94
views
Is there a way to change a generic function through the Unity inspector?
I have a StateMachine component that includes a list of "transitions". Each transition includes an origin state, a condition, and a target state. The transition should happen if the object ...
1
vote
0
answers
122
views
How to Prevent Character Controller Descent at Platform Edges When Using a Capsule Collider
CONTEXT: I am implementing a basic 3D character controller from scratch in Unity. For collisions, I do a capsule cast in the direction of the player velocity and use the collide and slide algorithm to ...
0
votes
0
answers
30
views
Friction not applied in fast collisions using Continuous collision detection modes
Starting in Unity 2022.3 versions, this started happening -
In my scenario, I have a ball bouncing on a surface (e.g on concrete) and no matter what the friction values are, the ball basically ignores ...
0
votes
2
answers
113
views
Remove group of elements from list
What is the best way, in terms of performance, to remove a list (a group of elements such as integers or strings) from another list, other than using for or foreach loops?
For example, is there a ...
0
votes
2
answers
275
views
Why are Time.realtimeSinceStartup and Time.realtimeSinceStartupAsDouble so slow when called repeatedly?
I have the following Update() code which calculates the approximate number of loops per second:
...
0
votes
1
answer
136
views
Character Controller isGrounded reports false when descending slopes
I encountered a problem in Unity related to the Character Controller, namely with checking whether the player is on the ground or not (isGrounded).
A player walking down a slope with a minimum angle ...