- Home /
 
               Question by 
               smirlianos · Mar 01, 2014 at 03:16 PM · 
                functionifcheckcall  
              
 
              How to check if a function is called?
Hello,
Is there a way to check if a function is called?
for example:
 if(SampleFunction().IsCalled)
 {
     //do stuff
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Lo0NuhtiK · Mar 01, 2014 at 03:32 PM
Have the function return a bool, or have the function change a bool.
ex 1 : changing a bool
 bool didFunction = false ;
 
 void SampleFunk()
 {
   //do stuff
   didFunction = true ;
 }
 void Whatever()
 {
    if(didFunction)
    {
       //do stuff
    }
 }
ex 2 : return bool
 void Whatever()
 {
    if(SampleFunk())
    {
       //do stuff
    }
 }
 
 bool SampleFunk()
 {
    bool didSomeStuff = false ;
    //do stuff
    if(certain things got done right etc)
       didSomeStuff = true ;
 
    return didSomeStuff ;
 }
Answer by Propellent · Sep 05, 2018 at 10:01 AM
 Debug.Log("In Sample Function!");
Anywhere in the function you're trying to call.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                