Reply To: [Question] Bind to components that are added at runtime.

NodeCanvas Forums Support [Question] Bind to components that are added at runtime. Reply To: [Question] Bind to components that are added at runtime.

#15304
Gavalakis
Keymaster

Hello there and sorry for the late reply!
Also thank you very much for your positive kind feedback!

Just to clarify, are you referring to Variable Property/Field Binding?
If so, you can actually add a property/field bound variable in design time, even if the component does not exist (yet).
In runtime, when the variables initialize, only then will the required components that the variables need, be tried to be found from the gameobject. As such, if you add the required components in runtime, the variables will initialize correctly.

Please note however, that variables initialization happens in Blackboard “Awake”. As such, you will need to have the components attached before the Blackboard “Awake” call. This can be sorted by modifying Unity Script Execution Order and have your component attachment code run before Blackboard (which runs in Default Time).

Please let me know if the above is what you mean, or if you meant something different.

Can you please provide a bit more specific info about what you try to do (and what complaints do you get), if the above is not the case?

Thank you in advance!

Join us on Discord: https://discord.gg/97q2Rjh