I´ve been following this series but got an issue in my game. I tried to ask in the comments but nobody is answering me. So, my sword doesnt spawn and when I press back Q,(input) the sheathing animation freezes. When I stop playing the level, gives me an error both in “Spawning Gear” and “Destroy Gear”.
The message is: “Accessed None trying to read property”
Hello @BabyZezinho can you send pictures of your blueprints and a picture of the errors you are getting ? So we can see where the issue is comming from.
Hey there @BabyZezinho! As AOB mentioned, it’d be easier to tell what’s going on if we saw the blueprint for sure. Though accessed none as an error stems from a blueprint trying to use a variable that is null, so it’s possible that your weapon variable that you’re trying to access hasn’t been set or is being unset or destroyed before you try to access it.
By the way, I added “Is valid” to that player ref, both to SpawnGear and DestroyGear. Is not happening the error anymore, but the Sword still doesnt show up in game. Those notes are in the Event Graph of the Animation Blueprint
Can show what you have in spawn gear ? And the is valid on the destroy gear notify event will return not valid because you haven’t plugged anything for the input object. You can also put print strings out of the invalid outputs for debugging.
@BabyZezinho The code here seams to be fine. So there is 3 reason why it might not work.
Check if the class you are getting from the struct is assigned to be the sword class.
Check if you are matching the slot name correctly. 3. And ensure that the SpawnGear function gets called. The Player Ref might not be valid and the function is never called. Actually you were getting Accessed none earlier so this might be the problem. To test it just put print string node in the Spawn gear and see if something gets printed when you take out your sword if it doesn’t that means Player Ref is invalid.
Edit: If the player ref turns out to be invalid send a photo of where you are setting it so we can fix it.