Skip to main content

New answers tagged

2 votes

Is it worthwhile to use events when there’s only one subscriber?

I've found this is more or less the entire point of design principles. When you learn design principles in schools or otherwise serious courses, you get taught to always use them no matter what. This ...
Themoonisacheese's user avatar
10 votes

Is it worthwhile to use events when there’s only one subscriber?

This question is on the border of "primarily opinion-based". There are no right or wrong solutions to software architecture problems. Only solutions that work for you or solutions that don't ...
Philipp's user avatar
  • 123k
3 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
  • 56
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
  • 261
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
  • 261
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
2 votes

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,976
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,976
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

Top 50 recent answers are included