Description

Float values with the meta tag expose on spawn aren't retaining their value when the value is set with a Spawn Actor node. It appears to only be floats. Maybe it has something to do with the change to Float Real in Blueprints. 

If you make a Blueprint of the c++ class you get the same results. Setting the value in code, or in the blueprint works as expected.

Steps to Reproduce
  1. Create a new blank C++ project
  2. Create a new C++ Actor
  3. In the Header file paste the following code below AMyActor()(line 17):
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (ExposeOnSpawn = true)) float var1;
  1. Save then in the Editor select 'Recompile and Reload' in the lower righthand corner
  2. Open the Level Blueprint
  3. Off of 'Event BeginPlay' node create a 'Spawn Actor from Class'
  4. Set Class to the MyActor then Right click the 'Spawn Transform' pin select Split Struct Pin
  5. Set Var 1 to 5.0
  6. Create a 'Print String' Node
  7. Drag off the 'Return Value' output pin of the 'SpawnActor' node then get Var 1
  8. Connect Var 1 to 'In String' input pin of the 'Print String' node
  9. Compile the Blueprint then Play in Editor

Expected Result:
5.0 is printed out

Actual Result:
0.0 is printed out

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-143935 in the post.

1
Login to Vote

Cannot Reproduce
ComponentUE - Gameplay
Affects Versions5.0
Target Fix5.0
Fix Commit19218950
CreatedFeb 25, 2022
ResolvedMar 2, 2022
UpdatedApr 25, 2022