- Home /
Question by
Devistute · Nov 27, 2015 at 02:09 PM ·
scripting problemsetactive
Disable Gameobject Via Script
I want to make my script to disable an object instead of destroy it, since destroying it seems to blow up console with errors. Here is my script;
function Start(){
Destroy (GameObject.FindWithTag("Player"));
GetComponent.<AudioSource>().pitch = Time.timeScale = 0.3;
yield WaitForSeconds (3);
Application.LoadLevel(0)
}
Problem is that i dont have any idea where to put "SetActive=False" there?
Comment
Best Answer
Answer by Munchy2007 · Nov 27, 2015 at 02:17 PM
Try
function Start(){
(GameObject.FindWithTag("Player").SetActive(false));
GetComponent.<AudioSource>().pitch = Time.timeScale = 0.3;
yield WaitForSeconds (3);
Application.LoadLevel(0)
}
Your answer
Follow this Question
Related Questions
Unity SetActive() doesn't activate object 1 Answer
Make a gameobject inactive and active 0 Answers
physics.OverlapSphere colliders 1 Answer
SetActive() not working 0 Answers
need help with armor customization 1 Answer