x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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 param 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...

Product Version: UE 4.17
Tags:
more ▼

asked Aug 09 '17 at 01:23 PM in Bug Reports

avatar image

kjustynski
186 9 16 27

avatar image Syed Aug 09 '17 at 04:09 PM

Wow.. how can they miss that?

avatar image Rudy Q ♦♦ STAFF Aug 10 '17 at 02:08 PM

Hello kjustynski,

I was unable to reproduce this issue on our end with the information provided. I have provided a screen shot of the function in the function library that I used. This setup appears to work without error on my end. Could give this a try and let me know if it works for you?

Example:

alt text

avatar image ViAxl Aug 11 '17 at 04:10 AM

3 days after releasing there're already a lot of reports on this particular issue. This should be a new and critical bug of 4.17. Print string works fine. However GetAllActorsOfClass inside a function library doesn't work, not all of the time. It's fairly unpredictable. Sometimes it works without changing anything. All were fine in 4.16 and I didn't touch anything.

I'm listing a few similar reports below. They're all 4.17 and posted within days. With all due respect please invest more resource in resolving this. A tracker link or "unable to reproduce this" doesn't help. This bug is hell because I've done a lot of work in 4.17 before it going rogue. Thank you.

https://answers.unrealengine.com/questions/677056/ue4-417-world-context-in-blueprint-function-librar.html https://answers.unrealengine.com/questions/666822/error-script-msg-a-null-object-was-passed-as-a-wor.html https://answers.unrealengine.com/questions/676246/a-strange-error-about-getworldfromcontextobject.html

avatar image kjustynski Aug 11 '17 at 04:23 PM

I have to admit it was difficult to find a stable repro with fresh functions. So... I created a stripped down project with just few scripts necessary to lure out this bug.

It's should be easy to catch it now. Just open a project and hit Play button :)
https://drive.google.com/open?id=0B8f7otnD-QKBUEZkR2lWVFVkMHc

To be perfectly clear on this: recompiling or renaming script calling library's function can "temporarily" fix the issue. It's coming back after restarting the project.

avatar image Rudy Q ♦♦ STAFF Aug 15 '17 at 04:04 PM

Hello kjustynski,

EDIT:

Was able to reproduce issue the issue using project provided.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Sorry for the confusion - this has been logged as UE-48464 (thanks kjustynski for the project!). Here is the fix. I will update this answer when I know what binary release this is a part of - but it should be 4.17.2.

more ▼

answered Aug 15 '17 at 07:08 PM

avatar image

Dan.OConnor STAFF
458 14 6 16

avatar image DiziART 6 days ago

Link fix - 404.

avatar image Dan.OConnor STAFF 5 days ago

If the link appears as a 404 make sure you're logged in to a github account that is associated with your Epic Games account.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

For those who may need an emergent solution. You can make a C++ AActor and put it in the level as a world context 'anchor', which could later be referenced by blueprint function library. Declare:

 static UObject* WorldContextAnchor;

Put the actor in your level. Add this in the constructor:

 WorldContextAnchor = this;

Then make a UBlueprintFunctionLibrary class which reads this static variable and pass it to BP function library as an effective world context (anything in a world can be used as world context). A bit dirty but at least my project is not completely dead now.

more ▼

answered Aug 13 '17 at 04:22 PM

avatar image

ViAxl
15 1 5 5

avatar image antoinegloum Aug 14 '17 at 02:35 PM

That's a lot of efforts. Personally, I prefer to stay with the previous release until this bug is fixed.

avatar image Dan.OConnor STAFF Aug 14 '17 at 05:51 PM

The compilation manager can be disabled via the project settings menu. I'm taking a look at this issue now, but don't let it block you from using other 4.17 features!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question