Cast reference object variable unpins when starting ue4

So I’ve stumbled upon a weird issue. Everytime I start UE4, some cast object variables get unpinned which causes me errors. If I pin them and compile they work fine… But get reset when I restart the engine again…

Any idea why this happens? It started doing so today. I think it’s a bug.

http://puu.sh/sqYdJ/55f6ecb608.jpg

UPDATE: I’ve found the root of the problem but I don’t know what’s causing it exactly. When I add a struct variable to my character(which where I’m casting the weapon reference variables from) this problem happens. When I remove it the problem disappears.

Here’s the struct in question.

http://puu.sh/ssZYv/5135575a02.png

So I tried removing the struct and add a new one with similar properties but different names. It worked for a few days but now it doesn’t work again. The issue is not the variable inside the character because if I do a make struct it’ll also unpin.

I have this too. There are some blueprints that are fine when saved, but constantly require recompile when I reopen the project. It’s really frustrating.

Start editor, connect the nodes, quit editor, delete saved and intermediate folder, does this fixes the problem? Should work unless there are wrong references in things like custom functions, or outdated structure references.

This does not fix the problem. The issue still persists even after I remove my saved and intermediate folders.

I have moved this into the proper ‘Bug Reports’ section for follow-up.

Hi ,

This is likely a cyclic compile issue. I was wondering if you have a project that you could share with us the exhibits these issues so we could debug the problem?

Hey -

How are you using your struct in the blueprint? Are the Primary/Secondary Weapon nodes coming from a Break Struct node? Can you provide a screenshot of your full blueprint setup?

Sadly the project is something I can’t just share publicly. I will try to make a custom project with just the necessary files though.

Also, there seems to be a bug with your username. It says User-1420270633 while pretty sure it should say Mike Beach?

The primary and secondary weapon variables are part of the character, a weapon on the ground is referencing them to check if the player is holding a similar weapon already. The actual weapons are attached to the player as child actors. The primary and secondary weapon variables are there for ease of use. I have tried referencing the child actor of the character directly inside the weapon to be picked up but that too gave me an error every time I start the engine.

The struct has the weapon classes in it. I use those weapon classes to set the child actors of the character.

http://puu.sh/szzVh/ebcc617fc0.png

This function is called inside the construction script with the struct as input.

http://puu.sh/szA4A/512f8479d5.png

Note that even if I unpin the construction script or not use the struct at all(just have it in my list of variables), the nodes still unpin on startup.

I THINK I FIXED IT

So I still think it’s a bug but it can be easily fixed.

The issue happens if you set a default value inside your class variable struct(Did I word that right?)

Basically, what I had was this.

http://puu.sh/szDbZ/70041352de.png

And changed it to this.

http://puu.sh/szDeb/28eeb121b5.png

Now, I do not know if this permanently fixes the issue as for all I know it might return after a few days, but I will report here if that happens. Thanks for the support everyone!

EDIT: It seems to be only happening when you use a childBP as default value