Please help dont know how to collect an object
It's simple. You use a trigger to check if the player is near the item. For example so:
`function OnTriggerEnter (other : Collider) {
//We are already picked up, so do nothing
if(GotPickedUp==true)
return;
//Is the player here?
if(other.CompareTag(“Player”))
{
FoundPlayer = true;
ThePlayer = other.transform;
}
`
}
Of course you would have to give your character the right tag, the item a collider that works as a trigger and check in an update routine if FoundPlayer==true then make the player the new parent.