[BP Compilation Manager] WorldContextObject is null in BP function library

Moth Doctor
Wed, 09 Aug 2017 13:23:08 +0000
Blueprint

It’s annoying issue we’ve encountered just after updating to 4.17.
We use BP function library to call methods like GetGameInstance(), GetPlayerController(). They require WorldContextObject which should automatically retrieved by method call placed in custom library’s function. Sadly functions like GetGameInstance() are provided with WorldContextObject = null.
It does happen in 4.17 with BP Compilation Manager turned on.
We didn’t notice any problems outside of function library.

Repro

1. Create a blueprint function library.

2. Add function which simply returns game instance by calling GetGameInstance(), GetPlayerController() or similar. Probably using every function with WorldContextObject will reproduce a bug.

3. Call this function in any actor or level BP.

4. Restart editor. It seems crucial - at some point I though I fixed issue by renaming function library file (there were no errors). But errors came back after reopening project.

5. Play game - make sure you call method from point 2.

6. Stop game. You should get message “There were errors in game” and list of errors in Messages window.

There are two workarounds for this issue.
A) Turn off Blueprint Compilation Manager in Project Settings.
B) Pass WorldContextObject from object calling this library’s function. It’s nasty and makes function library not that convenient…

15 posts - 9 participants