Can't figure why im getting this error :accessed none

http://puu.sh/gzqxf/791e92332a.png

This is my blueprint, im getting the following error : "Accessed none ‘last hit actor’ from node ‘destroy actor’ in blueprint ‘mycharacter’ ".

I have no idea how to fix that error. Any suggestions ?

Try to validate your Item Variable you taking in before assigning it. (IsValid Node) Thats just a guess from looking at it but I would need the Message Log and Output Log to be sure.

“Accessed None” is a very often and important error.

In C++ you have Pointers. They CAN point to an Class Object. Or better to the address of that object on your PC memory.

These variables (pointers) can be NULL. They are empty if you don’t fill them. (INT Variables for example aren’t null. They have a number in them. If you don’t fill it there is still a number in it).

If you now want to use the actor the pointer SHOULD point to and the pointer is NULL (so it is not pointing to any actor/object) you will get the ACCESSED NONE error.

In C++ you would use a small "if(MyPointerVariable != NULL) to make sure that you don’t access it if it is NULL.

In BP you can use “IsValid” (like Martin Egger told you). This will only proceed if the variable is valid(not null).

I guess you error comes from using a variable that should save the last hit actor and destroy it. Your variable can be NULL if you don’t hit something but still call the function. If you are using a line trace, you could using a branch and plugin the trace result. This will make sure that you have hit something.

But if you want to make it better, use IsValid or make sure that you can’t use the Destroy on an empty variable.