"Delete Unused Variables" from GameInstance deletes variables used in other BPs

Just what the title says: using Delete Unused Variables in a GameInstance Blueprint deletes all variables not used locally, even if they’re accessed from other Blueprints. Using Find References in the variables finds the references on other BPs correctly though.

Maybe it affects it: most of the variables it deleted in my project were used only in UMG Blueprints.

Another thing that may be the culprit: this GameInstance BP is a child of a C++ one.

Hey -

Can you provide any additional information on how your blueprints are setup or which variables in specific are being deleted? I tried to create multiple blueprints with variables added, including GameInstance blueprints. However when I use the Delete Unused Variables option in a blueprint, none of the variables in other blueprints are affected. If you’re able to reproduce this behavior, please include the reproduce steps to help me investigate the problem locally.

Thanks for your time, !

Try this:

  • Create GameInstance BP
  • Add some Integer variables to it.
  • Get and Set these variables inside any other BP but the GameInstance itself.
  • Compile all of them to make sure UE knows about their relationship.
  • On the GameInstance BP use the Delete Unused Variables function.

Result

UE deletes the Integer variables, probably because they’re not being called in the BP they were declared at. Even though they’re being called in other BPs.

Expected

UE knows the variables are being used externally and doesn’t remove them.

Thank you for the clarification, I did not understand that you were referring to a referenced variable. This issue has been reported here: Unreal Engine Issues and Bug Tracker (UE-7074) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers