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"

Can not link PaperSprite to PaperSpriteComponent

I just want to link sprite to paperSpriteComponent and keep getting this 3 errors:

1.Use of undeclared identifier 'ConstructorHelpers'; 2.Member reference base type 'const wchar_t [28]' is not a structure or union; 3.'UPaperSprite' does not refer to a value;

  // Fill out your copyright notice on the Description page of Project Settings.
     
     #include "Skybox.h"
     #include "PaperSpriteComponent.h"
     #include "PaperSprite.h"
     
     // Sets default values
     ASkybox::ASkybox()
     {
         // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
         PrimaryActorTick.bCanEverTick = false;
         
         if(!RootComponent) {
             RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SkyboxBase"));
         }
         
         SkyboxSprite = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("SkyboxSprite"));
         SkyboxSprite->SetupAttachment(RootComponent);
         // this line gives errors without it project compiles just fine
         SkyboxSprite->SetSprite(ConstructorHelpers::FObjectFinder<UPaperSprite>(TEXT("/Game/Sprites/Skybox_Sprite")).Object);
     }
     
     // Called when the game starts or when spawned
     void ASkybox::BeginPlay()
     {
         Super::BeginPlay();
         
     }
     
     // Called every frame
     void ASkybox::Tick(float DeltaTime)
     {
         Super::Tick(DeltaTime);
         
     }

I am out of ideas. I've tried to make it work all day, but keep getting the same error.

Product Version: UE 4.18
Tags:
more ▼

asked Mar 13 '18 at 04:12 PM in C++ Programming

avatar image

U-Turn
5 1 2 5

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

1 answer: sort voted first

Try to include:

 #include "UObject/ConstructorHelpers.h"
more ▼

answered Mar 13 '18 at 05:15 PM

avatar image

Shaggy41
341 2 7 5

avatar image U-Turn Mar 13 '18 at 05:33 PM

Omg. you are my Hero! How do people know this things? I've spent hours... :(

(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