Answer the question
In order to leave comments, you need to log in
Unity3D 5 - where is the best place to handle collisions?
Hello. Interested in the question about the performance of scenarios in the game.
There is an object "star" and "character". The character can collect stars.
Where is the best place to handle the OnTriggerEnter event, in each star or in the character?
According to the idea, if in each star it turns out that each star will expect events.
If it is for a character, then the already clogged code will be replenished with the next portion of the condition.
I don't know exactly how Unity does them, but I suspect performance degradation.
Answer the question
In order to leave comments, you need to log in
Of course, it’s faster on the character. Since the junky needs to process each component. If there are a lot of stars, then the components will also, respectively, performance will drop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question