How can I control parenting and unparenting over multiple functions in one script, when I want to control the unparenting in OnCollisionExit it is not working, because it is unknown? Also the part about Parenting in the script refference is really short and does not really help.
function OnCollisionEnter(other : Collision)
{
var myTransform = other.transform;
myTransform.parent = transform;
//
if(whatEver)
{
playerTransform.parent = null;
}
}
//
function OnCollisionExit(other : Collision)
{
//Unparenting will not work because myTransform is unknown, How to make it so, that I can control it from OnEnter & OnExit??
//myTransform.parent = null;
}