VTubeTiny
VTubeTiny copied to clipboard
Components under a "Publisher" will not get a published value
let's say we this stack of components
it should notify CharacterAnimatorComponent and SpeakingColorChangerComponent
but currently it will not notify SpeakingColorChangerComponent
Why does it do that?
most components will Start once, and that's when they are made
public override void Start()
{
_components = GetComponents<ISpeakingAwareComponent>(); //<---
//...
}
after that they will never update.
Solution
On new Component Update all previous components.
Potentential issues
A component might do a "Should only happen once" event twice
Hmm, a potential solution I can think of, is that when we initialize all of the components for an actor, we call Start for all of them only after we've created all of them. This way, we can ensure that all of the components have been created before we call the Start methods for them, which would solve this issue for the case when we load in a scene.
For the editor however, we can potentially create some sort of ICreationAwareComponent interface, where components that implement it will get updates whenever a new component gets created within the actor.