- Home /
Display spinning icon while some search method in progress ?
In unity I worked a game project and I want to UI display loading icon(like spinning circle) while my search method(it returns bool value by the way) is working which takes time about 4-5 seconds. how must be the right algoritm ? I tried coroutine but couldn't integrate it. if someone give example, link or any suggestion I appericated. thanks in advance...
public class myclass : MonoBehaviour { public bool ismethodsearching; void Start() { ismethodsearching = false; }
 void Update()
 {
     if (ismethodsearching)
     {
         gameObject.GetComponent<Transform>().Rotate(new Vector3(1,0,0));
     }
 }
 //main duty of this method find whether word is in list or not
 //and also with a global value "ismethodsearching" I want to manage image 
 //rotation
 bool searchmethod(string[] wordlist, string targetword)
 {
     ismethodsearching = true;
     foreach(word in wordlist)
     {
         //some other operations
         if (targetword == wordlist)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     ismethodsearching = false;
 }
 void Startsearchmethod()//when clicked button this method will be called
 {
     if(searchmethod)
      { 
      do something ;
      }
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                