__WorldContext pin appears and doesn't let to save my Blueprint

I have a function CanTakeCover in my BlueprintFunctionLibrary, which contains a LineTraceByChannel function. When I refer to CanTakeCover, there appears a __WorldContext input pin. I guess it’s because LineTraceByChannel needs a world context object and engine automatically creates this pin for me. I supply this __WorldContext pin with what it wants and everything works, but once I re-open editor and try to save this functions library, engine says “can’t save MyLib.uasset …” (see picture).

If I delete CanTakeCover node from my graph, it saves. How to fix it?

Update: I re-created this situation with an elementary function Foo with no input pins, but with only node LineTraceByChannel in its graph. If I put this function somewhere, re-open editor and try to save functions library - it won’t save.

There may be some steps here you can take that might help.

It seems nothing listed in that topic helped me. But I found in external references a line

"BlueprintGeneratedClass /Engine/Transient.REINST_MyLib_C_119 (1)". 

MyLib is my functions library. It looks like library references itself.

Update: when I remove any invocation of function with __WorldContext pin, reload editor - this line with circular reference disappears.

I think it’s a problem to try to use Blueprint library as a world context object, particularly if it’s calling itself. Blueprint library functions are static functions, so need a WCO if they need to work on world like a trace call.

Maybe try setting up calling function to take an actor and use it as WCO. Any actor should do, a blueprint library isn’t an actor, so that’s probably half problem, other half being its referring back to itself as WCO.

I’ve already tried it, setting function to take an actor as WCO. After compilation, __WorldContext pin disappears, but Blueprint won’t save anyway.

I think it will not cure while I’m calling library functions inside same library, as you assumed it’s referring back to itself. So, perhaps, I have to implement my functions in an actor sub-class, or use C++ to avoid editors misbehaviour.

Hi duburian,

This sounds like same issue reported here:

Looks like a function in a Blueprint Function Library that references another function in that library cannot be saved after closing and reopening project. I’ve created a bug report as UE-11185 for this. If your Library function doesn’t refer to another function within itself, does this error cease to occur?

Hi ,

It depends on function I refer to. If it contains something that needs World Context Object, like raycast, it causes troubles. If I get rid of everything that needs WCO, I can refer to functions within same library without problem.

I decided to implement my functionality in a sub-class of Actor. It even makes sense in my case. So for me it’s not a problem any more.

Thank you for response!

I’ve had some difficulty moving from 4.6 to 4.7. I’ve moved a good deal of blueprint scripting to C++ and have noted a good increase in stability. Especially with structs. I was getting a lot of blueprint compiliation errors and dreaded ‘can’t save…’ error. Moving these types to C++ seems to have helped.

Good luck!

Blueprints are good and evil. I also suffered from them, but they come to help when you want to quickly check your idea. It incredibly decreases iteration times for me, since I have long compilation times on my laptop (f.e., entire engine compiles in 1.5 hour). But when idea is proven, it’s wise to move everything “blueprint” to C++.

Good luck! :wink:

I’m pretty sure bug listed here is same as I just reported here:

https://answers.unrealengine.com/questions/231716/blueprint-compile-error-could-not-find-a-pin-for-t.html

There is a workaround in that bug report should you run into this issue in future.