Hello, i created a class in c++ that derives from AActor and that has the following variable:
UPROPERTY(EditAnywhere, Category = "Test")
class AActor * Test;
I create a blueprint based of that class and when i go to the defaults section of the blueprint he has the Test variable with the value None. I click the drop down and when i pick an actor from the level and it doesn’t change, it’s always None. I’m using 4.6.1 from the latest commit of the release branch.
I was able to reproduce the issue of the defaults tab not holding the assignment correctly and have reported the bug to our internal tracking database (UE-8522) for further investigation by an engineer. In the mean time you could add “BlueprintReadWrite” to the UPROPERTY field and then set the value in the blueprint’s construction script as a workaround.
After speaking with one of our engineers I found out that this is actually by design. This is to avoid a situation where the game tries to create the actor from your blueprint (with the Actor variable) before the actor that the variable is set to is created. If that were to happen the blueprint would have no reference to what the variable is supposed to be set to and could cause other issues (including a crash). Using the method of adding BlueprintReadWrite to the UPROPERTY is likely going to be the simplest solution to the issue.
Ok thank you for the feedback, gonna try to use the other method. I would suggest putting a comment on the field explaining that or something like that, because other people will probably also think it’s a bug.