I want to disable a gameobject and all its components like scripts,charactercontroller, material and all at runtime… I searched for it… I found SetActiveRecursively(false) but it only disables the gameobject and its children but not its components… so any solution?
What is the goal ?
Because when you do this : SetActiveRecursively(false) you un-active the Gemaobject and all the components have no more effect on your app.
To desactive each components you must do a loop on all of them, and set their enabled property to false.
foreach (Behaviour childCompnent in thisGameobject.GetComponentsInChildren())
childCompnent.enabled = false;
This will disable all the components attached to ‘thisGameObject’ and all of its children.