Question by 
               epichi123 · Aug 14, 2014 at 09:03 PM · 
                instantiateinvokeinvokerepeating  
              
 
              Trying to Invoke method: Spawner.SpawnObject couldn't be called.
I don't have an error, it just says:
 Trying to Invoke method: Spawner.SpawnObject couldn't be called.
This is the script:
 #pragma strict
 
  // The object to be spawned
 var SpawnObject : GameObject;
 
 // in seconds
 var SpawnStartDelay : float = 0;
 var SpawnRate: float = 5.0;
 
 function Start()
 {
     InvokeRepeating("SpawnObject", SpawnStartDelay, SpawnRate);
 }
 
 // Spawn the SpawnObject
 function Spawn()
 {
     Instantiate(SpawnObject, transform.position, transform.rotation);
 }
Thanks in advance! :)
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by rutter · Aug 14, 2014 at 09:02 PM
You want this:
 InvokeRepeating("Spawn", SpawnStartDelay, SpawnRate);
SpawnObject is the name of a variable. Spawn is the name of the function you want to call, so that's what you should pass to invoke. 
Answer by grasan · Feb 05, 2016 at 02:38 AM
Hi I have a similar problem whit my projekt. The code looks like this
 void Start()
 {
     value = Random.range (1, 3);
     
     if (value == 1)
     {
         Invoke ("Heads", 3);
     }
     else
     if (Value == 2)
     {
         Invoke ("Tails", 3);
     }
 }
 void Heads()
 {
     mainCamera.transform.position = new Vector3 (-17.5, 2, 0);
 }
 void Tails()
 {
     mainCamera.transform.position = new Vector3 (17.5, 2, 0);
 }
what am i doing wrong?
adding answers to old questions isn't going to get you the help that you're after. post a new question and be as clear as possible including any (complete) error message that you've received.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                