- Home /
Question by
Rudamiester · Dec 08, 2012 at 05:11 PM ·
stop
How can I completely stop a script?
Hello, I need some help here, I'm trying to stop this script after the player has clicked on the "Steam_valve", so that clicking on the "Steam_valve" again won't do anything. Can someone help?
function OnMouseOver()
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, hit, 2.0))
if(Input.GetMouseButtonDown(0))
{
GameObject.Find("Steam_valve").transform.Rotate(0,0,90);
GameObject.Find("Steam_wall").SetActiveRecursively(false);
}
Comment
Answer by kag359six · Dec 08, 2012 at 05:23 PM
Just use Destroy() method to remove that script component after it has been used.
Your answer
Follow this Question
Related Questions
Scripts stop working in Maximize On View and testing on Android 0 Answers
Stop Script Completely. Doesn't Execute Another Line Of Code. 1 Answer
Timer that stops at the end of the game 3 Answers
Stop the script - problem with myObject's rotation. 0 Answers
How do I stop an 'IF' function from running from another script ? 2 Answers