Hi,
all of a sudden my project with several autoinstantiating singletons began crashing for no apparent reason.
I made a build the day before, at it’s working without any problem.
Today, my log was full of several apparently unrelated errors about the drawn item being out of the frustrum, 1 per editor redraw.
by doing some debugging I discovered that a [ExecuteInEditMode] monobehaviour only applied to a certain instance of a prefab (and I had NONE of them in the scene) was executing some code.
I then realized it was executing the code from the prefab object!
I know kind of solved the problem by not executing the code if the component is on a prefab but yet…
…is this a bug or a feature?
Can I leverage on this to have autoexecuting code when importing a prefab from a package?
This seems kind of dangerous. Is there a way to have [ExecuteInEditMode] automatically work on scene objects only without having to do extra checks? Are there any possible attributes or solutions to prevent this (without actually writing checks in methods or properties)?
Were you aware of this?
I’m using Unity 5.4.2f2