Hi there, I am working on an fps project in which the Character can throw objects. I have created a state management system for anything that would be throwable as shown below:

Then I have create a resource class called Throwables which just contains some basic config

And since this is how my scene actually looks like:

I have attached to it a init script which should simply handle the existence of the throwable and it's initialization in the world, but this is where the problem comes to light, because it does not get initialized... and I have zero clues as to why.

When I execute the code I get the error: "Throwable data is not assigned! Make sure to assign the Throwables resource to this object." and upon trying printing the throwable_data I only gety <nil>

What am I doing wrong?

    Goofy
    What happens if you delete this? Does it work?

    Goofy Throwable data is not assigned!

    Well, assign it in the editor.

      @kuligs2 @xyz Sorry for the delayed answer but I was looking for the solution. I must thank you because you helped me indirectly to solve the problem. While removing the check for throwable_data would've been just hiding my lack of understanding of the problem, under the rug, it somehow still made the code work.

      Then while checking I noticed that I have declared the THROWABLE_PREFAB as a PackedScene

      If you notice in the inspector, I have added a scene I created as the PackedScene

      While testing through stuff, at some point I have deleted the scene I have attached as a PackedScene to the ThrowingPlayerState BUUUT no garbage was collected and all the data remained persisted - see below to see after deletion

      CONCLUSION: I had to re-assign the PackedScene.

      xyz All the basics were done already - at least that what I thought.