I think I don’t get some fundamentals. I’m sorry for a noob-question but cannot find it in the docs. How does it happen that an editor renders dummy white sphere for an empty blueprint actor? How can I achieve that for my custom C++ actor?
When I create it like this:
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DumbPathNode.generated.h"
UCLASS()
class PROTOTYPE_API ADumbPathNode : public AActor
{
GENERATED_BODY()
public:
ADumbPathNode();
UPROPERTY(EditAnywhere)
ADumbPathNode* NextNode;
protected:
virtual void BeginPlay() override;
};
It is not visible when I drag it into level in an editor. Blueprint inherited from this class is visible and rendered in editor as a white sphere. Why?
Header: #pragma once #include “CoreMinimal.h” #include “GameFramework/Actor.h” #include “DumbPathNode.generated.h” UCLASS() class PROTOTYPE_API ADumbPathNode : public AActor { GENERATED_BODY() public: ADumbPathNode(); UPROPERTY(EditAnywhere) ADumbPathNode* NextNode; protected: virtual void BeginPlay() override; UPROPERTY(EditAnywhere) USceneComponent SceneComponent;* };
Code: #include “DumbPathNode.h” ADumbPathNode::ADumbPathNode() { this->SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT(“SceneComponent”)); this->RootComponent = SceneComponent; } void ADumbPathNode::BeginPlay() { Super::BeginPlay(); }
Try adding the emboldened lines to your code, then drag your C++ script into the scene and it should work.
Hi BrujoCorvino, thanks for an answer. Unfortunately it does not work either. It was the first idea that came to my mind. Actor is still invisible in editor