I have an inventory script for a minecraft-ish game i’m making. When the player drops an item, it spawns a new physical item pickup into the world using this code.
Problem is, the prefab for the item also has a script attached to it that lets me set the item count if the player is dropping a bunch of the same item at once. Let’s say the script name i’m trying to access is called PhysicalItemPickup.
How would i access PhysicalItemPickup from this prefab I just created to set the item count that I need?
How so? Right now the newPhysicalItem is just a RigidBody3D. I can’t access the components of the PhysicalItemPickup script through naive means such as newPhysicalItem.stackCount. I feel like there’s an extra step i’m missing.
This is the item. When it gets dropped by the player, this is what is spawns. The newPhysicalItem is the topmost root node, which is the RigidBody3D with the PhysicalItemPickup script attached.