Announcement

Collapse
No announcement yet.

How do I spawn a 3D widget in C++?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I spawn a 3D widget in C++?

    What I am currently doing is the following. However this generates several errors on Compile.


    .h
    Code:
    /** 3D Widget */
    
    UPROPERTY(EditAnywhere, Category = Widget)
    class UWidgetComponent* Screen; //This is the only line of Code that will compile, but only by itself.

    .c
    Code:
    //Widget Settings
     Screen = CreateDefaultSubobject<UWidgetComponent>(TEXT("Screen"));
    //Mesh is of type StaticMesh
    //Camera is a Socket on StaticMesh
     Screen->AttachToComponent(Mesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale, TEXT("Camera"));
    Build LOG
     
    Spoiler
    Please excuse the bad grammer and spelling, i'm dyslexic and that means I am required by law to get at least one spelling and grammar mistake in everything I post.
Working...
X