Variable Links in Blueprint break sporadically, reason not obvious

This might be a little long in order to explain exactly what I have set up. Hopefully someone can tell me what I’m doing wrong or do it a better way, but since the “breaks” in the blueprint logic only occurs sometimes… I’m kind of assuming its a bug with the editor, perhaps on load?

I have a master pawn actor called bsBall, that then has two children blueprints: bsBall_Enemy and bsBall_Player. I originally had made many children blueprints of bsBall_Enemy (ie: bsBall_Enemy_Bomber, etc) and had wrote most of their unique functionality in each.

However, later I decided I wanted to make my enemies more easily borrow logic from each other so I instead started making the children of bsBall_Enemy empty holders (enemy classes in name only) with which I spawned and attached child actors to them that adjusted their functionality (now I would spawn bsEnemy_Item_Bomber and attach it to the bsBall_Enemy, and now I have the ability to mix and match such functionality). I got that working pretty well and to make things easier I create an bsEnemyStruct with all the common variables I would need and a resulting bsEnemyDataTable.

So now in bsBall_Enemy, on BeginPlay I have each enemy get its display name, find its matching row name in the bsEnemyDataTable, get all the variables from that row and then assign those values to the matching values in the actor. So, on BeginPlay bsBall_Enemy_Bomber would spawn, get its display name bsBall_Enemy_Bomber, find the corresponding row in the data table, grab all the values, assign them to itself, and we’re done.

However, some of the variables in my DataTable that are assigned are the Child Actors mentioned above, the components that I can assign to give each enemy different functionality. My problem is, is that after a few hours or when I come back to my project to do some work all my bsBall_Enemy blueprints will be broken and it happens in my function in that blueprint where I am getting all the information from the DataTable. For some reason the variable links for the Child Actors break. The execution links remain but the links between my Child Actor variables aren’t there… which breaks my blueprint and every subsequent blueprint based on it.

There are other things that break as well, like a user widget I spawn… but I’m chalking that up to just the parent blueprint not working and it freaking out.

I hope this made sense, any help would be greatly greatly appreciated.

My bsEnemyStruct. If you notice at the bottom, NavMode through EnemyItem5 are all placed with a default. I originally assumed the breaks were happening because the Struct didn’t have a default, doesn’t seem to be the case.

My bsEnemyDataTable

My parent bsBall_Enemy getting and setting variables on BeginPlay

Inside the function in previous image, Get Enemy Data Table Info. This is where the break happens (sometimes). You can see I’m casting to a class, that is the main parent for all the Child Actors I’ll be setting.

I changed the variable type in my Struct to a more specific class. Not sure if it will have any effect. Now I wait 24 hours to see if it happens again.

Oh okay, didn’t have to wait too long. I think its strongly associated with a crash of the editor.

Hi ,

I was unable to reproduce this in 4.13. Can you try in 4.13 to see if you get the same results? If you do, what steps can I take to reproduce this on my end?

Hi ,

Thanks for getting back to me. I have moved to 4.13 as of this morning and I cleaned up almost all my issues by moving stuff out of the bsEnemy blueprint. The only thing that I haven’t been able to fix is casting to my Widget Healthbar on bsEnenmy. This is a Widget Component with the Widget a bsEnemy_Widget_Healthbar class and yet it acts like it can’t talk to it?

This alone breaks my blueprint, everything online tells me its a circular dependency but I for the life of me can’t find out where. I’ve rebuilt it and tried to fix it several times. I also tried interfaces but I’m not as experienced with those, will have to take another go of it.

I’m not sure how it can’t be a circular dependency, the only real dependency is that the bsEnemy must spawn and the Healthbar comes with it.

Hi ,

So I rebuilt a lot of it using interfaces which is only slightly better. Again, when the editor is running I can get everything working perfectly. However interfaces still leave you wanting, because even still when you restart the editor the bsEnemy blueprint is broken, every time. The reason its better however is it doesn’t actually break any links like before with casting, it just requires a simple recompile. However, it still means that’s break that blueprint and about a dozen child blueprints tied to it. Definitely wouldn’t ever want to ship something like this.

My sneaking suspicion, which would explain both the casting failures and the need to recompile instances is the Get User Widget Object node is broken some how. Whatever comes out of that node will break, maybe not all the time and in every case (as my other blueprints that use it are fine) but I can’t explain how they are any different.

Okay, I solved my problem. I’m not exactly sure why or how. I might as well chalk it up to ghost in the machines. However, I will say I went to an old blueprint that I used to store a lot of stuff in… a blueprint I really wasn’t referencing for much of anything and I cleaned out a lot of its old variables. That is the best guess I have as to why this situation resolved it self, my circular dependencies that I could not find went away, and everything works perfectly now.

Never mind, I restarted this morning and it still won’t let me communicate to the HealthBar with out compiling on start up.

Use the “As Widget Enemy Healthbar” output pin on your cast to the Update percent node, does this help the error?

I’m trying to explain that. That is what gets disconnected on editor start up. I can set it and set it again, but if I restart the editor it breaks its connection even though its completely legit.

Anyways, I solved the problem. As mentioned before, I have a parent class and two children. I was updating the two children’s health bars in different ways (in each child) and changing the widget for the health bar for each child. I ended up consolidating the health bars to one type of widget in the parent as well as the way I updated it… this somehow removed the issue.