23-07-2021, 08:38 AM
(This post was last modified: 23-07-2021, 08:42 AM by josemendez.)
(22-07-2021, 08:25 PM)sothorael Wrote: I was just thinking of what is probably a newB question - if the solver is separately placed outside the character (say an invisible box in the scene) and the emitter is spawned by script, how would the solver know it? Or would the emitter/s need to exist in the character already at runtime?
The solver will update all actors -emitters- that are underneath it in the hierarchy. So as soon as you parent an emitter under a solver (at any hierarchy level, no need for it to be an immediate child) the solver will start updating it. You don't need to explicitly tell the solver which emitters to update.
Internally, the way this works is that the emitter calls GetComponentInParent<ObiSolver>() in OnTransformParentChanged(). This way, every time the emitter is re-parented, it looks for the first solver it can find above it and registers itself on that solver (and unregisters from any previous solver)
No need for the emitter/solver to exist in-editor, they can be both created at runtime.
From the manual:
http://obi.virtualmethodstudio.com/manua...olver.html
Quote:Every actor needs to have a solver up its hierarchy in order to get updated and rendered.