Skip to main content

New answers tagged

2 votes

Animation can't disable gameobject

Final frame sampling in Unity is not guaranteed and this has been an issue for a very long time, move your de-activation earlier or don't use it in the animation editor at all. This is due to the ...
Windex's user avatar
  • 36
15 votes
Accepted

Destroying the parent when all children are destroyed

After searching for a better way, I came across OnTransformChildrenChanged: The following changes to direct children of a GameObject invoke ...
Zibelas's user avatar
  • 5,012
0 votes

How to make TextMeshProUGUI truncate the left part (beginning) of a line?

I needed to truncate the beginning of a text and display ellipsis, starting from the end and discarding the first words of the text. For instance, ...
Curio's user avatar
  • 241
0 votes

How can I get Unity to do letterbox/pillarbox to maintain aspect ratio?

I tried @Almo solution but actually it didn't work in all the cases: It was ok with aspect ratio 2:1 It was ok with aspect ratio 4:1 It was not ok with aspect ratio 1:2. As you can see below, the ...
Curio's user avatar
  • 241
1 vote

How do big open worlds handle Object Pooling?

What you need to consider is which objects in your game only differ by data and which differ by components. For example, when you have a lot of projectiles in your game which only differ by speed, ...
Philipp's user avatar
  • 123k
3 votes

How do big open worlds handle Object Pooling?

One important consideration to add is that most open world games are not built in a managed language like the C# used in Unity. In a managed language with an automatic garbage collector, creating and ...
DMGregory's user avatar
  • 141k
1 vote

What’s the correct / idiomatic way to pause a game in Unity?

I usually use the system you described first - set Time.timeScale to 0 and provide an easily accessible bool to check if the game is paused. Note that this can get ...
Kevin's user avatar
  • 6,946
0 votes

How do big open worlds handle Object Pooling?

many different weapons with many different bullets. Do you have to create one pool for each? Maybe not for all bullets. A small handgun and a weapon that shoots faster will probably have almost the ...
Kevin's user avatar
  • 6,946
1 vote

Can't get a Prefab to scale down accordingly inside a Container

Using a simple card prefab, adding only the Aspect Ration Fitter to it and having a container with the horizontal layout group (added an image for better seeing the container) and a simple button ...
Zibelas's user avatar
  • 5,012
1 vote

Unity Animation Curve to change value over time

The usual workflow with animation curves is to design them with the visual editor in the inspector. Your code can then sample the values of the curve via the ...
Philipp's user avatar
  • 123k
1 vote
Accepted

Why is my rigidbody not moving when I press the buttons? I can't see any reason it shouldn't

GameObject SDK was set to None, fixed by changing it to PhysX
IamaPineapple24's user avatar
1 vote
Accepted

When should an object with a collider have a rigidbody?

The advice you've found is a little oversimplified. There's an unstated assumption here: If you have a moving object with a Collider2D and you want that movement to ...
DMGregory's user avatar
  • 141k
2 votes
Accepted

Can PNG format be used for alpha channel-packing for URP shader in Unity engine?

There are two sides to this: Can Unity correctly import and use a PNG image with channel-packed alpha? Yes. In the texture import settings inspector, just make sure to leave the "Alpha is ...
DMGregory's user avatar
  • 141k

Top 50 recent answers are included