UPROPERTY(VisibleAnywhere) not working

Hey all,

So I am trying to do the first part to the code for the “Macros starting with UPROPERTY” video… So far as I can tell, there is no difference between what Ben put in and what I have inserted (everything to this video seems to be working the way it should) but the command is giving me an error… My code can be seen below (from the OpenDoor.h header file):

// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;

private:
UPROPERTY(VisibleAnywhere)
float OpenAngle = 90.0f;

};

The errors that I am getting are (and the full code):

Thanks so much and any help would be appreciated!

1 Like

If you can compile it in the editor, compile it there and the error message might be more helpful.

Hey, thanks for the response. What do you mean compile it in the editor? I tried compiling it in VS and what I thought were the most relevant errors are in the image. If you wan t to see the other error in completeness, I can get you it… Like I said, the only thing that I actually changed in the file was the:

private:
UPROPERTY(VisibleAnywhere)
float OpenAngle = 90.0f;

Sorry if this hasn’t been helpful, I’m just not certain where you want me to try recompiling the code…

Thanks again!

1 Like

@Trevor, I think DanM wants you to compile in the unreal editor with this button

And check the Message Log in UEditor. I usually find the message there clearer.

So the errors that I got from the Unreal compiler are as follows:

Thanks again

And your OpenDoor.cpp? code thats around line 27?

1 Like

I had the same problem, but compiling it in the Unreal Editor seems to have worked even though Visual Studio doesn’t accept it.

Right, I completely missed that the error is coming saying that it is coming from the .cpp file not the header file… Apparently a bracket had been added to this line. I fixed that and now the project compiles. Thanks all for the help!

I have also problem with my UPROPERTY.
I do everything as Ben in the lecture:

but Unreal don’t show me Open door property

I try as compile from Unreal and Build from Visual Studio
what can I do?

Did you try restarting the Unreal editor?

I don’t know what’s happened but now i add it ATriggerVolum property and the problem was solved both of them (Open Angle and Pressure Plate) is visible, but without Pressare Plate Open Angle did not appear.

Hello I have a few question:

  1. how the ATriggerVolume* PressurePlate is connected the TriggerVolume object which we added in the world?

Connetions
TriggerV

  1. which object is connected AActor* ActorThatOpens. how it switch on the world.
  2. AActor* ActorThatOpens and ATriggerVolume* PressurePlate both of them are pointer object and how can use it with out give them any address?
  1. You set it within the Unreal Editor
void UOpenDoor::BeginPlay()
{
	Super::BeginPlay();
    //////////This line////////////
	ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
    //////////////////////////////
}
  1. You do in the editor you are giving it the address, and here in code you’re getting the pointer of that expression which will be an address.

sorry
opendoor

by the first line ATriggerVolume* PressurePlate connect the TriggerVolume object (which is in Unreal editor).

by the second line ActorThatOpens connect Default Pawns

and outcome this ATriggerVolume* PressurePlate pointer object take the adress of TriggerVolume Unrela object
likewise AActor* ActorThatOpens pointer object take the adress of Default Pawns
is my judgement right?

and last what is the Default Pawn? as I guess it’s Player, body of the game

Yes and the defaultpawn is the actor in your scene which you posess at the beginning of the game.

thank you :slight_smile:

Privacy & Terms