Download

Calling a custom event from character BP

Is this possible ? While it´s easy to call a custom event from the level BP I can´t seem to call it from my character or any other BP. The custom event is available in my character BP so I guess somehow it´s meant to work there, too. But I don´t know what to plug into the target slot to make it work. I tried to create a variable with type “changeactor2” (wich is the actor that contains the Custom Event). I also can plug it in and it compiles without errors. But it won´t fire and gives me the following error message after stopping the preview. changeactor2ref is the variable i created btw.

Error Blueprint Runtime Error: Accessed None trying to read property changeactor2ref from function: ‘ExecuteUbergraph_VRCH_Default’ from node: Scustom in graph: EventGraph in object: VRCH_Default with description: Accessed None trying to read property changeactor2ref

Where is your Custom Event Located? If it lies within your Character BP and you want to call it from your Character BP, you don’t have to plug anything in your Target Slot.
If your Custom Event is located in another Blueprint, and you want to call it from your Character BP, you need to get a reference of this Blueprint.

It´s located in another blueprint wich is just a basic actor. When I add my custom event from the level BP I will automatically get the reference to the BP the event is located. But not when calling it from my character. I have no idea what to uses as target.

You do incorrectly think your character class does have a relation to the level per default. But that’s not even what you want. You want to design your character in a way that it can be used in any level correctly.

When you drag&dropped an actor of that blueprint class into the level, you created an instance of that blueprint class. This is automatically done. Your level does now have a reference of that instance.

When you just create a reference variable of that blueprint class in your Character BP, that variable is empty. You will always get “Accessed None trying to …” errors when you call any events of it. You need to either create that instance by yourself (SpawnActorFromClass node) or you have to set it with for example the instance you drag&dropped into the level (GetAllActorsOfClass → Get(0), this does obviously only makes sense if your level does have only exactly one instance of that blueprint class). One class can have many instances in a level, how could the class know what instance you want to call the event on? And there are many more ways to get references to instances. Traces for example.