Hi,
I want to add a script of my own (of type ScriptComponent) on runtime to a transform node.
something like
let characterControllerTrans = this.someTransform.clone("characterController", null);
characterControllerTrans.addComponent<Project.CharacterController>();
Thank you
Pinging @MackeyK24 again in case they haven’t seen
Do you mean instantiating a configured prefab at runtime or actually constructing up an object from scratch completely at runtime ?
To instantiate a prefab you configured in the Unity Editor:
1... Setup the node and attach any script components
2... Export the selection to create a separate glb to load as an Asset Containers
3... Load the Asset Container at runtime
4... Call the BABYLON.SceneManager.InstantiatePrefabFromContainer
To construct an object from scratch:
BABYLON.SceneManager.RegisterScriptComponent
Example Playground