Uniject icon indicating copy to clipboard operation
Uniject copied to clipboard

Support for Start() method that fires after constructor but before the first Update()

Open ticking-clock opened this issue 12 years ago • 1 comments

Adds an optional overridable Start() method on TestableComponent that will be called after the constructor but before the first Update(). Included a test for verification.

The purpose of this is to allow authors to write Component classes that feel more like they inherited from MonoBehaviour. It is also sometimes desirable to guarantee that code executes after Awake() (which in this case is simulated by the constructor).

I'd like to add support for Awake() but can't see a viable way to do it with injection (Awake must be called after all objects are initialized).

ticking-clock avatar Jan 14 '13 20:01 ticking-clock

Fixed per banderous's comment and merged into single commit.

ticking-clock avatar Jan 20 '13 20:01 ticking-clock