Hallo,
i have the following script which works fine, but i want to save much work for me.
I have to attach this script to many many Gameobjects and i dont want to drag´n´drop the var Rigidbody to every single attached script.
How can i change the code, that the var is always the same ? :?:
]var Spielerkamera : Rigidbody;
function Update(){
var dist = Vector3.Distance(Spielerkamera.position, transform.position);
print ("Distance to other: " + dist);
if (dist > 20){
renderer.enabled = false;
}
if (dist < 20){
renderer.enabled = true;
}
}
EDIT: in other words, the “var Spielerkamera : Rigidbody” should always be a certain Rigidbody