Description

After creating a custom struct in C++ and adding a variable of that struct type to a Blueprint, hot reloading a code change that involves altering a function that takes the struct as a parameter results in the variable disappearing from the Blueprint, and a new variable of the same name cannot be created (an error message stating that the variable already exists is displayed).

Steps to Reproduce
  1. Create a new code project using the first person template.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new Actor code class to the project.
  5. Close the Editor.
  6. In the header file for the new Actor class, add a new USTRUCT that includes 3 or 4 properties.
  7. Add the BlueprintType specifier to the USTRUCT.
  8. Add a BlueprintCallable UFUNCTION to the new Actor class that takes the struct created in step 6 as a parameter.
  9. Build the project in Visual Studio.
  10. Open the project in the Editor.
  11. Create a new Blueprint derived from the Actor class created in step 4.
  12. In the Blueprint, add a new variable and set the type to the struct created in step 6.
  13. In Visual Studio, make a change to the function that was created in step 8.
    • In my test, I changed the return value type.
  14. Click the Compile button in the Editor.

RESULT:
When the compile completes, the Blueprint will no longer show the variable created in step 12, and trying to create a new variable with the same name will show a message saying the name "is in use by another variable or function!"

EXPECTED:
The compile completes, and the variable is still visible and usable in the Blueprint.

WORKAROUND:
Don't perform a Hot Reload whenever altering a function that takes a custom struct as a parameter when that struct is also used as a variable in a Blueprint.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

4
Login to Vote

Fixed
Fix Commit14261971
Main Commit14261971
CreatedAug 27, 2015
ResolvedMay 24, 2021
UpdatedMay 24, 2021
View Jira Issue