Skip to content

Creating a component

Nako Sung edited this page Nov 26, 2015 · 3 revisions

You can add components just like you can do with native c++ constructor using ComponentClassName.CreateDefaultSubject. Note that your root component should be hold within UPROPERTY.

class MyActor extends Actor {
  ctor() {
    let someComp = WidgetComponent.CreateDefaultSubobject("WidgetComponent0")
    this.SetRootComponent(someComp)
    this.Comp = someComp
  }

  properties() {
    this.Comp/*WidgetComponent*/;
  }
}

Clone this wiki locally