Gurulis99
(Gurulis99)
November 10, 2020, 8:09pm
1
Hello i am trying to create an actor component from an actor component but nothing happens… I call these two lines in my Actor Component but nothing happends…
pathAnimationScript = CreateDefaultSubobject<UPathAnimation>(TEXT("TEST"));
owner->AddOwnedComponent(pathAnimationScript);
Any ideas??
Alekann01
(Alekann01)
November 14, 2020, 3:22pm
2
Create DefaultSubObject can only be called in the classes constructor as it will serialize the component so it can be used with the editor.
If you want to create the components at run time, you will need to spawn them and attach them. There are many similar questions to this.
NewObject or CreateDefaultSubobject - Programming & Scripting - Unreal Engine Forums Can I dynamic CreateDefaultSubobject but not just in init function - Programming & Scripting - Unreal Engine Forums
Alex