When using a CircleComponent
with ComponentParticle
, an exceptions gets raised for CircleComponent._centerOffset
not being initialized. This happens because components added to ComponentParticle
are not really part of the component tree. This mean they never get correctly loaded and mounted. ComponentParticle
only makes sure to invoke the render
and update
method of the component that it encapsulates, essentially skipping all the standard component lifecycle processing.
CircleComponent
, should work with ComponentParticle
. Ideally any kind of component should working with ComponentParticle
.
Adding following code to any game should reproduce the problem.
await add(
ParticleSystemComponent(
particle: ComponentParticle(component: CircleComponent(radius: 2)),
),
);
Output of: flutter doctor -v
N.A.
Flame version: 1.14.0
Platform affected: All
ββββββββ Exception caught by rendering library βββββββββββββββββββββββββββββββββ
The following LateError was thrown during paint():
LateInitializationError: Field '_centerOffset@1199492026' has not been initialized.
I can only think of converting the Particle
class into a Component
to make it work properly for all components. This sounds like a big change and I probably won't have enough time to working on this, so reporting this issue.
But there are more such component-like classes which I think need to be streamlined. EffectController
is one such example where they need to be ticked every frame.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too