How do I add a script component at runtime?

#1

Hello,
I am new to Xenko, and I was wondering how can I attach a ScriptComponent to an entity in code (at runtime). I am porting a Unity library (DragonBone runtimes) to Xenko.
I am using the latest stable release of Xenko (3.0.0.9).
Thanks in advance.

0 Likes

#2

hi @Sasinosoft,

you just have to call something like:
var script = new MyScript()
myEntitiy.Add(script);

2 Likes

#3

Thank you very much.
All I had found on the net was code from older versions of Xenko in which it was done in a completely different way.

0 Likes