Getting very weird error while trying to get my sprite from C++. My code as follows :
UPaperSpriteComponent* BaseBonusSpriteComponent;
BaseBonusSpriteComponent = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("BaseBonusSpriteComponent"));
ConstructorHelpers::FObjectFinder<UPaperSprite> DoublePoint(
TEXT("PaperSprite'/Game/TexturesSprites/Collectables/Buff_2xPoint_Sprite.Buff_2xPoint_Sprite'"));
int32 RandomBonusIndex = FMath::Rand() * 2;
switch (RandomBonusIndex)
{
case 0:
BaseBonusSpriteComponent->AttachTo(CollisionSphere);
BaseBonusSpriteComponent->SetSprite(DoublePoint.Object);
break;
}
Getting error as:
void ConstructorHelpers::ValidateObject(UObject *,const FString &,const TCHAR *)’: cannot convert argument 1 from ‘T *’ to 'UObject *"
Anyone have solution for this?