C++ exposed variable "In use pin no longer exists on node"

Hello,
I’m having this very frustrating situation that I’ve seen on a couple of posts here but nothing quite specific to my situation. I have a class in c++ that exposes a variable to be read in a blueprint (more specifically a Widget Blueprint). However, after having renamed a few variables in the c++ class, I get the following error every time I start up my project in UE4 now:

For reference these are the relevant c++ classes that define and use this variable that I’m exposing.

Here is the class that defined the “chargedAttack” variable:

And here is the class that uses that stores an instance of the Attack Type which has the chargedAttack variable:

I can temporarily fix this issue by just refreshing the node that is causing the problem, but I have to do that every time I open the editor. I have tried deleting and re-creating the BP function but that doesn’t help either.

This is my first post on here by the way so sorry if I put this in the wrong category.

1 Like

Bump. Still not able to solve this problem.

I’ve tried deleting and recreating the source c++ that this variable comes from and its children blueprints as well as duplicating the blueprint trying to access this variable.

I’ve had this occur before when renaming variables or making major changes to a class, but don’t think Ive had it persist quite like that. You might want to try deleting your Intermediate and Build folders so you can get a fresh compile and see if that helps. Also just be sure your bp is properly compiling and saving.

Unfortunately I’ve tried to delete my Intermediate, Build, and save folders and then rebuilding all the source files. Yet the problem persists.

After reconnecting the pins in question, the blueprint builds, saves and runs just fine. The only issue is that it reverts back when I close and reopen the engine.

Edit:
I’ve also realized that this problem also appears when I am packaging the game into an executable. It gives the same error about not being able to find the “in ue pins”.

2 Likes

Hello, were you able to resolve the issue while packaging? I’m running into something similar myself.

1 Like

Sorry man, I tried many things and nothing seems to have fixed the issue. I haven’t touched UE4 in like a half year because I’ve been busy with other things. I would have hoped that there would have been an answer or an engine update to fix this.

Please update this post if you ever figure out what the issue is so that others can know.

This can happen because you’ve added a class redirect that is the same name as a class that you previously had. For instance, what happened to me was that I had UWeapon and AWeaponActor. I realized that AWeaponActor is redundant, so I switched those names around:

AWeapon
UWeaponItem

As you may or may not know, Unreal Engine uses the A and U prefixes by convention because a lot of the code generation is knowing whether a class is an UObject or an AActor. For this reason Unreal Engine omits these prefixes from the class name, so in reality my AWeapon class was always named Weapon. When we think about it in these terms, WeaponActor, WeaponItem, and the one that collides: Weapon, are the only classes that have ever existed.

So after renaming these classes you’ve likely added your class redirects. The engine will continue to use these redirects as long as they exist in the DefaultEngine.ini file.

In my case, they looked like this:

+ActiveClassRedirects=(OldClassName="WeaponActor", NewClassName="Weapon")
+ActiveClassRedirects=(OldClassName="Weapon", NewClassName="WeaponItem")

Now that we know about how naming classes works, we can see the problem: Weapon is becoming WeaponItem, which is NOT the correct redirect. It was relevant when the class was a UWeapon, but it’s no longer correct when the class is an AWeapon. The engine, in its search for AWeapon, will instead refer to UWeaponItem when the editor starts.

This is an easy fix:

  1. Make sure that all of your blueprints that had the old class have been reparented correctly (this is the reason the class redirects are so useful). It is EXTREMELY important that you manually reparent all of the offending blueprints to the new redirect.
  2. Delete the class redirects.

The next time you launch the editor, the node will no longer complain.

2 Likes

Please see my comment for the answer. Hopefully this helps you with your project. Cheers.

This is EXACTLY what is happening to me. I was willing to deal with the annoyance of having to refresh the nodes every time I opened the editor (I also found that CTRL ALT F11 hot building would also clean up the broken nodes) but now I am trying to package the game for testing and I’m getting that broken pin error every time it compiles regardless of whether I’ve fixed it in editor for that session.

I am going to research this answer more. I am new to C++ and following a class/tutorial so my understanding of this answer is moderate at best but it seems like something important to understand better.

Ah HA! So I was curious to see if the problem was connected to my use of the hot-reload compiler thing (CTRL-ALT-F11) to build my code each time. So I tried closing the editor completely and rebuilding the code in Visual Studio then reopening the project. Sure enough the project loaded without any broken pins and when I packaged the project it compiled just fine. Lesson learned.

4 Likes

This was really helpful, thanks!

This is what fixed the issue for me on UE5.3, thank you for posting. I had this issue with a C++ function exposed to blueprint and also some C++ BTTasks added to a behavior tree that also threw errors on startup constantly. I closed UE5 editor completely, went into Rider and did ‘clean solution’ and ‘build solution’, then re-opened my project in UE5 and voila! it all worked finally!! It does seem to be an issue related to live-coding compiles.

1 Like