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"

Help improving a Player within Actor bounds test

Hello UE4 community,

can anyone advise me on how I can improve my Player is within Actor Bounds test? I'm getting occasional Blueprint runtime errors when the Get Player Pawn evaluates to: None. This test is used to control doors on a dynamically resizing actor to prevent them locking while the player is on the wrong side.

 Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetPlayerPawn_ReturnValue from function: 'ExecuteUbergraph_A100001' from node: Set Player_Inside_Maze in graph: EventGraph in object: A100001 with description: Accessed None trying to read property CallFunc_GetPlayerPawn_ReturnValue

It still works as intended, but I don't like having errors if I can avoid it. The none property appears to happen before gameplay actually starts. So I am guessing that it is happening in a brief moment before the player pawn exists. The boolean output is tested on an overlap event that (at the time) had not been triggered.

alt text

Any thoughts on how I might do this better or prevent that error being generated? Thanks in advance! :-)

Product Version: UE 4.18
Tags:
more ▼

asked Aug 22 '18 at 12:09 PM in Blueprint Scripting

avatar image

LoneScrapBot
25 3 3 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Before checking your condition, you can check whether the Pawn is valid, like so: IsPawnValid

pawnisvalid.png (62.5 kB)
more ▼

answered Aug 22 '18 at 12:20 PM

avatar image

xSheim
120 4 9 15

avatar image xSheim Aug 22 '18 at 12:27 PM

But according to your condition, wouldn't it be easier to use a volume for this check https://docs.unrealengine.com/en-us/Engine/Actors/Volumes?

avatar image LoneScrapBot Aug 22 '18 at 12:43 PM

Hi xSheim. Quite possibly.

I did it this way because the actor (a maze) I need to test is dynamically generated and resizes constantly during gameplay on a single level map.

In order to use a volume I'm assuming I'd need to match it to the Maze actors bounds (minus some padding) dynamically every time the maze's re-generate function fires. It isn't something I had considered or investigated. If I were to do it that way, there may be future use for a Nav Mesh Volume if that would work. I really have no idea how to use them yet though.

I'm pretty green. ;-)

avatar image xSheim Aug 22 '18 at 01:54 PM

Glad it helped. You can attach a volume to your actor (to detect overlaps you can use the Trigger Volume) and then dynamic resizing wouldn't be a problem. But I think it would be a different-topic question. As for the Nav Mesh you mentioned, it could help: https://answers.unrealengine.com/questions/223395/dynamic-navigation-mesh.html

avatar image LoneScrapBot Aug 22 '18 at 12:50 PM

Bam.

Adding an IsValid check on the Player Pawn has stopped the error. Thank you so much. :-) Now I can live with my (quite possibly terrible) inside bounds test!

(comments are locked)
10|2000 characters needed characters left
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