D
D
Dmitry Gavrilenko2015-06-25 19:24:18
Game development
Dmitry Gavrilenko, 2015-06-25 19:24:18

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

1 answer(s)
V
Vladimir Alkhimenko, 2017-09-13
@Maddox

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 question

Ask a Question

731 491 924 answers to any question