I have been searching for the term for multiple hours and cant find any help…
function Update(){
if(Input.GetKey(KeyCode.Q)){
child = transform.Find("Player/Item"); //find the item
child.transform.parent = null; //remove it from its parent
}
}
Assuming this is on the player, you are starting too high. Line 3 should be:
transform.Find("Item");
You don’t include the name of the game object that you start with in the path. For example say you had a hierarchy like:
Player
Items
Item1
Then to get to item1 starting with the transform of player, you would to:
transform.Find("Items/Item1");