Storing A Variable of a spawned child class breaks UE4

Super easy to reproduce (Using UE4: 4.2.1):

  1. Get the third person template based on blueprints
  2. Create a child of ‘MyCharacter’ using the ‘Create blueprint based off’ feature (or by selecting it’s parent in blueprint properties)
  3. In MyCharacter, add an input (eg. Keyboard input) and make that spawn actor from class: MyCharacter_Child

AT THIS POINT, it will work. Nothing is wrong, you can save, spawn more you’s, exit and reload the file.

HOWEVER, if you promote the created MyCharacter_Child to a variable - it breaks. The code will work, but if you exit the project, then get back in, UE4 will crash whenever you try to open a blueprint, and the project is ruined.

You actually don’t even need to set the variable, creating it on the side of type MyCharacter_Child and never so much as referencing it will have the same effect. It freaks out over the existence of using that as a variable type.

As far as I can see, it’s a (nasty) bug in blueprints, would love a fix or if anyone has a work around.

Hello, Hennez!

Thanks for the bug report! I’ve looked into it, and I can’t replicate the bug on our internal build or on the 4.3 preview. So the good news is that this bug has been fixed in the next edition of the engine!

As for a workaround, what are you trying to do? I can try to help you find a workaround if you tell me what you’re aiming for.

Regards,

Jonathan

Hi Jonathan,

Thanks so much for the quick response. Haven’t moved over to 4.3 just yet, but glad to hear it doesn’t replicate there. I realized it was a bad case of cyclic dependency - I had a parent object which was trying to store a variable of it’s own child, which caused the issue. So I should be able to work around it by being less bad xD Though if the engine could just fail to compile the blueprint instead of causing it to never open again that would be much nicer.

Thanks again,
Matt

Glad to hear you figured out how to fix it! In 4.3, it just prevents you from creating the cyclic dependency, which makes some sense.

(And you’re very welcome!)