Class Asset ID variable gets corrupted on editor restart

Hello,

I seem to have some bad issue with asset loading/referencing/dependencies. It is a BP project. I would post pictures but it will be hard to see what breaks where specifically, so I will try to describe the issue and if someone would like to see how something specific is implemented, I’ll make a screen.

I have the following setup:

  1. There is a BP asset “ClassToActionRelation” of type Object. It contains an array of structs. One of the struct members is of a BP “ObjectAction” type, Class Asset ID (the pink one). Another member is a Class reference of certain BP class.
  2. There is a BP Actor Component called “BComp_ObjectActions”. It contains a function that returns as a result an “ObjectAction” Class Asset ID (same as that Struct member). Inside that function queries “ClassToActionRelation” class defaults, takes the array of structs and iterates on it looking for an entry that has the Class reference matching that of owning actor of the “BComp_ObjectActions”. If it finds such an entry, it takes the corresponding “ObjectAction” Class Asset ID and returns it as function out result.
  3. This result (resolved into a class) is then used to spawn an actor, etc.

The setup works fine in-game. But on editor restart, blueprintable component breaks. It does not compile and contains a number of errors, coming mostly from the mentioned function:

  • Function return type is lost, it is set to some “PLACEHOLDER-CLASS ObjectAction”
  • So is the variable that I use to store the result in.
  • Some links are broken but can be reconnected with no errors.
  • The array that was supposed to hold all the spawned instances of “ObjectAction” sets its type to “Object”. This causes links to break in other blueprints where this array is used.

Setting the variable and the function return type to the correct BP Class Asset ID, reconnecting broken links - it works again.

It seems to be an annoying technicality of how UE4 handles these things. “ObjectAction” BP (an ordinary Actor BP) seems to not be loaded in time for when other blueprints need it to compile their scripts? Or something along the lines. What would be the correct way of doing this?