언리얼
Error: Inappropriate '*' on variable of type 'CustomStruct', cannot have an exposed pointer to this type. 오류
쉬엄쉬엄하자
2021. 11. 18. 17:16
728x90
언리얼 스트립트를 컴파일 할 때 제목과 같은 오류를 해결하는 방법에 대해 알아보겠습니다. Error: Inappropriate '*' on variable of type 'CustomStruct', cannot have an exposed pointer to this type.
사용자 정의 구조체를 USTRUCT를 통해 에디터에 노출 시키거나 블루프린트에서 활용하려고 할 때 USTRUCT의 포인터를 또다시 UPROPERTY로 하고자 할 때 발생합니다.
예제 코드
USTRUCT(Atomic)
struct FChangeViewInfo //사용자 정의 구조체
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
float NextChangeBetweenTime;
UPROPERTY(EditAnywhere)
AActor* NextView;
};
UCLASS()
class QUICKSTART_API ACameraDirector : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACameraDirector();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditAnywhere)
TArray<FChangeViewInfo*> ChangeViewInfoArray; //ERRRRRRRRRRRRRRRRRRRRRRR
float TimeToNextCameraChange;
int TargetCameraIndex;
};
이럴 때 오류를 해결하기 위한 아주 간단한 방법이 있습니다. 단지 포인터를 사용하지 않으면 됩니다.
value타입을 사용하거나 reference타입을 사용하면 오류를 해결할 수 있습니다.