i have used
void OnTriggerExit(Collider Player) {
GameObject.Find("player").GetComonent("Head Look Controller").active = false ;
}
but its not working .
i have used
void OnTriggerExit(Collider Player) {
GameObject.Find("player").GetComonent("Head Look Controller").active = false ;
}
but its not working .
i want to disable it like if it was unchecked in the editor . is it possible ?
As far as I know this is not possible. To deactive a component you need to destroy it with Destroy( GameObject.Find(“player”).GetComponent(“Head Look Controller”)).
Then use AddComponent to “activate” this component again.
if i removed it and then add it again i will lose the settings , right ?
Correct. Maybe it will be better to avoid this behavior and to keep the component.
how come then we can turn the check box for the comonent on the fly from the editor ?
Not every value you can change in the editor is accessible via script.
damn , thank you
The variable isn’t active but enabled. Which is what the Inspector toggles.