- Home /
Play animation upon file creation
function Update(){
if (System.IO.File.Exists("filepath.txt" ))
{
animation.Play("myanimation");
}
}
If i enter a correct file path, will this script play the animation upon the file being created in that directory.
Answer by roamcel · Aug 09, 2011 at 05:51 AM
I would not put that check on "Update", since it looks more like a one-shot function, however, the answer is YES.
And to tell the truth, you can put ANY self-updating condition in the if evaluation, which will lead to 'myanimation' play when true.
I thought that I should put it on update because the file is going to be generated at runtime...
$$anonymous$$akes perfect sense actually. If you need to check the status in real time, Update is the right function indeed, besides, if you are otherwise triggering the check, just call the function whenever needed, since its call in Update will access the disk (or cache) at a tremendously high rate
Your answer
Follow this Question
Related Questions
Cant assign animation to script 1 Answer
Weapon customize system 1 Answer
Using multiple buttons in script 3 Answers
Strange issue changing the animation state 0 Answers
Trouble creating a text file 4 Answers