Hi there,
why is OnValidate() executed several times?
Cheers
Hi there,
why is OnValidate() executed several times?
Cheers
More precisely described: Why is OnValidate() executed multiple times during play mode?
Do you have public fields where the values are changing during your play? It may be that it is detecting these public/Inspector fields are changing and therefore executing.
From the docs for when OnValidate executes:
It does also say that it is:
Have you checked to see if it is executing when running a built version? It shouldn’t be.
Even with a Debug.Log() it will run 3 times to program start. Therefore it seems to have nothing to do with changeable variables. But why so often? In the built version it is not executed.