How to store a 3D object in Resource script and insatiate it?

Godot Version

4.3

Question

I am working on a project and want to add the players equipped item to the players body. I was wondering what the best way to store a 3d model in a resource script is and how to add it in a scene.

Right now in my project I have the players equipment slot read info from an item_data resource script and set that as the current equipped item in the games root script.

Then in my player character script I thought I could get the current equipped item_data from the root script and insatiate the object on the player as a child. Doing this I got an error about not being able to add a packed scene as a child.

This has made me confused on how to attach a 3d model to the item data resource that I create for each item.

I have also thought about trying to preload the 3d model scenes but then how could I connect that to each of the item_data resources.

you have to call “.instantiate()” on the packed scene and add this as child

1 Like

wow thank you! I cant believe it was that simple, I defiantly over complicated it in my head.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.