Hi Everyone,
I’m spawning my player character in my FirstPersonCharacter Blueprint using the Blueprint code attached below 1.png.
But I’m getting a runtime error Cannot Access ‘FirstPersonCharacter_C_9’. It is pending kill. Property: ‘K2Node_DynamicCast_AsBase_Character’ from node.
Clicking on the node shows a function attached to my HUD 2.png.
Any ideas how I could solve this? I don’t believe I’m calling kill on the FirstPersonCharacter anywhere in my Blueprint code, so I’m not sure where this is coming from? Thanks!
Hi,
Reduce the value of health to see if it stops this error. I believe that somewhere in your blueprints you have a function which handles if player’s health<0 then kill/destroy?
Hi Innos,
Thanks, I just tried lowering the health but it didn’t help. I’ve checked through my Blueprints, but I don’t destroy the FirstPersonCharacter anywhere (my game is not needing it yet haha).
Just to clarify, everything was working fine when FirstPersonCharacter was in the World Outliner - but I deleted it from there so that I could spawn it instead (I was having a problem where my dedicated server was spawning a character player too and I figured that was because the FirstPersonCharacter should not be in the World Outliner but rather spawned on each client.
So, yeah everything was fine, but deleting the FirstPersonCharacter from the World Outliner and using those spawning BP’s above have left with me with this error.
Any ideas what it could be?
What if you try to do the same code in level blueprint?
That worked Innos!
So, the obvious question I have now is: Why did spawning work in the Level Blueprint but not in the Begin Play event of the FirstPersonCharacter Blueprint. Any ideas?
Shouldn’t you be casting to ‘FirstPersonCharacter’ instead of ‘BaseCharacter’ inside the HUD? Maybe try printing a string when the cast fails to see if that’s where the problem is. I think the problem is that somewhere you’re trying to reference the FirstPersonCharacter you had in the level (when now it might be named FirstPersonCharacter_C_9 or whatever name it’s assigned when you spawn it…which isn’t the same) and it’s not there, and it’s not sure what to do if it’s not there, so it gives that error…or at least that’s my guess.
Level blueprints affect directly the level.
As for the first person character I think that you must “throw” him into the world so it can function and if you do that, it appears to the world outliner. By removing it from there, you removed it from the world or caused it to malfunction