- Home /
Make message to other gameObject stop.
In my project, I have a gameObject go to a certain position when it receives the message "CueReset" from another object. However, I want it to only change the position once, not continually put it back to the same spot each frame. How can I do this? Please note that I have very little experience.
void ResetCue() { transform.position = new Vector3 (CueX,.09895F,CueZ); }
Thank you so much for answering.
Answer by GhostlyFedoras · Jul 17, 2019 at 10:43 AM
You could add a Boolean value so that it knows if you've done it before, When it has been runthrough once set the value to false.
bool Neverdone = true;
void ResetQue()
{
if (Neverdone == true)
{
transform.position = new Vector3 (CueX,.09895F,CueZ);
Neverdone = false;
}
}
Your answer
Follow this Question
Related Questions
How to Spawn Object at next Empty Location 1 Answer
Revers Object Transfrom using an array problem in UI !! 0 Answers
Locating Position of Object not Working? 2 Answers
Relative Rotation of GameObject 3 Answers