x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Issues Creating TextRender Component

Header:

 class FE_API AFEObject : public AActor
 {
     GENERATED_UCLASS_BODY()
     
     UPROPERTY(VisibleDefaultsOnly, Category = Object)
     TSubobjectPtr<class UCapsuleComponent> Capsule;
 
     UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
     TSubobjectPtr<class USkeletalMeshComponent> Mesh;
 
     UPROPERTY(VisibleDefaultsOnly, Category = Text)
     TSubobjectPtr<class UTextRenderComponent> FloatingText;
 
 };

CPP:

 AFEObject::AFEObject(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
 
     Capsule = PCIP.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("Capsule"));
     this->SetRootComponent(Capsule);
 
     Mesh = PCIP.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("ObjectMesh"));
     Mesh->AttachParent = Capsule;
 
     FloatingText = PCIP.CreateDefaultSubobject<UTextRenderComponent>(this, TEXT("ObjectMesh"));
 
 }

The error is:

error C2439: 'TSubobjectPtrConstructor::Object' : member could not be initialized

error C2440: 'initializing' : cannot convert from 'UTextRenderComponent ' to 'UObject '

I checked the docs and it says UTextRenderComponent is a UObject, so I don't understand what the problem is.

Product Version: Not Selected
Tags:
more ▼

asked Nov 08 '14 at 12:26 AM in C++ Programming

avatar image

slev23
10 3 8 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It probably has something to do with your includes. Are you using EngineMinimal.h or Engine.h in your FE.h file? Using the latter one might solve your problem.

Additionally, you named your Mesh and FloatingText the same which will cause issues when launching.

more ▼

answered Nov 08 '14 at 06:58 PM

avatar image

harm
21 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question