Hello, I study the engine based on the book by William Sheriff, and is now focused on creating NPC. He brought the example code to show the new settings:
UCLASS()
class GOLDENEGG_API ANPC : public ACharacter
{
GENERATED_UCLASS_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
TSubobjectPtr<class USphereComponent> ProxSphere;
// This is the NPC's message that he has to tell us.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCMessage)
FString NpcMessage;
// When you create a blueprint from this class, you want to be
// able to edit that message in blueprints,
// that's why we have the EditAnywhere and BlueprintReadWrite
// properties.
}
Of course it did not work for the new version, and I had to rewrite it (using code from other resources).
UCLASS()
class GOLDENEGG_API ANPC : public ACharacter
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
USphereComponent* ProxSphere;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCMessage)
FString NpcMessage;
// Sets default values for this character's properties
ANPC();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};
Then I Recompile this class in Blueprint, but the details do not have fields with my variables. Where is the mistake?