Unreal.js icon indicating copy to clipboard operation
Unreal.js copied to clipboard

error when composing actor and components

Open Wu-HaoHao opened this issue 7 years ago • 1 comments

when composing component for an Actor

class MyActor extends Actor{
    ctor(){
        var sp = SphereComponent.CreateDefaultSubobject("sphere");
        this.SetRootComponent(sp);
        var cam = CameraComponent.CreateDefaultSubobject("Cam");
        cam.AttachTo(this.RootComponent);
        var mesh = StaticMeshComponent.CreateDefaultSubobject("mesh");
        mesh.AttachTo(cam);
    }
}

javascript console will throw this error:

Error: TypeError: cam.AttachTo is not a function
Error: TypeError: cam.AttachTo is not a function

it will tell you about the first component that tries to attach to root (Cam), twice, but seems to work for the rest of the components the structure looks like this

  • RootComponent(Inherited)
    • Cam(Inherited)
      • mesh

which all seems to work, except root component does not retain the name

any help suppressing or fixing this?

Wu-HaoHao avatar Apr 02 '17 05:04 Wu-HaoHao

I used cam.AttachParent = this.RootComponent

greentec avatar Nov 10 '17 13:11 greentec