Trouble Fixing Custom Event Call Error

I’m building a simple golf game where the player can charge up their shot before firing which looks like this:

It works fine but it keeps returning this error and after trying for hours I cannot seem to fix it:

Blueprint Runtime Error: “Accessed None trying to read property Tee”. Blueprint: FirstPersonCharacter Function: Execute Ubergraph First Person Character Graph: EventGraph Node: Begin Charge

I tried creating a reference function InputAction >> Call to BP_Tee but then that breaks that function and it no longer works when I attempt to Test and Use it which is why the PrintString is there to check if its working or not.

I was trying to get it work and this is as far as I got at the moment but what I really wanted was the charge/play to only work on the BP_Tee when the player is using it, however, couldn’t figure out a way around that yet other than to stick it on the player so my thought is maybe thats causing it somehow, not sure yet.

Any ideas? What am I missing here?

“Accessed None trying to read property
Tee”. Blueprint: FirstPersonCharacter
Function: Execute Ubergraph First
Person Character Graph: EventGraph
Node: Begin Charge

You’ve created a Tee reference variable to an actor. But this variable is just a pointer - not an object, it can refer to an instance of Tee but the editor does not know which one. You may have hundreds of Tees…

There are many ways of obtaining the pertinent reference to an actor that you need but it’s circumstantial. You’ll need to provide a bit more detail.

For example, how are the instances of the BP Tee actor created? Does the player spawn it / them? Did you manually place it in the Level? Some other way? Will you only have 1 or there might be more?

Ahh okay, I think I kinda see where you’re going with it and will try to play around with it more. I’ve been using UE4 for awhile but I struggle to understand things like this stuff still so I think I’m gonna try to refer to UE4 Documentation moreso to attempt and hopefully try to figure it out better. I was messing with it before and looking at the UE4 Docs but just kept getting confused, still kinda am unfortunately.

Basically BP_Tee is a Skeletal Mesh (for flexing animation when pulled back during charge) that I’ve added to a Blueprint Actor that is placed onto the Map/Level. It’s not really spawned in and there’s nothing except the Mesh on the actor with the Tee Object inside it and a bunch of code for charging the golfball up at the moment. The Skeletal Mesh also has a socket in it for the Golfball which is spawned on top of the Tee as well. I kinda thought the flexing animation would be interesting so I went that route.

Eventually, I’m thinking of possibly making it with the BP Tee Actor placed in 2 maybe 3 different spots so the player can choose where to use the golfballs but for now I just started with 1 spot to build upon and ran into that issue trying to understand how to correct it and where I was going wrong with that.

Is the player also placed manually in the level or spawns dynamically?

Is the player also placed manually in
the level or spawns dynamically?

In this instance. This is my player:

  • they’ve got an Instance Editable array of Tee pointers, currently the array is empty
  • and they can fetch the reference to a Tee actor by index (there are other methods, too)

Below is my level where we can populate the player’s array with the references of other actors that are also in the level:

  • 3 Tee actors at the top
  • the player is in the bottom left corner, that actor is currently selected
  • you can see the Instance Editable array waiting to be populated with scene actors under the Default tab

I’m 99% sure it’s manually placed, when I press play it’s spawning on the FirstPersonCharacter BP Actor that is placed in there even though there’s a Player Start Point. To clarify, I started with the FirstPersonCharacter Template and haven’t really messed with anything else yet.

The idea is that the player is going to be able to move around, pick up golfballs out of a bucket, and place them onto one of the Tee’s which can then be used of course.

So if you have only 3 actors to reference, the easiest way to select one could look like this:

If I remember correctly, that template starts with the player in the level already, so the below suggestion would work well.

Ahhhhhhh Okay, now I see what you meant now. I was using a reference before but had it backwards, it wasn’t that so no wonder it wasn’t working since it didn’t know where.

Also, perhaps you do not even need set the references upfront. Since the player will be moving around, and selecting stuff, you surely have an interaction method on your mind.

  • point and click
  • proximity to the area
  • select from UI

What I suggested above would work fine but it’s quite inflexible, and if you planned on having 50+ levels, setting it all up would result in a royal pain in the carpal tunnel…

That worked, thanks so much! I understand this a lot better now and I appreciate the breakdown and assistance. You rock!