I’ve been following the walkerboystudio tutorials, but I decided that I’ll try and write everything with Boo instead of unityScript [or JavaScript … whatever you wanna call it]
in the first lab project , they call a function from inside the update() that contains Yield waitForSeconds() call , when I did that with Boo the whole function doesn’t get called
here’s my both scripts
JavaScript:
var numberOfClicks = 2;
var waitTime = 2.0;
function Start () {
}
function Update () {
if(numberOfClicks <= 0){
var position = Vector3(Random.Range(-7,7),Random.Range(-4,4),0); //random positions between 2 points
respawnTime();
transform.position = position; //set the object hit to this new position
numberOfClicks = 2;
}
}
function respawnTime(){
renderer.enabled = false;
yield WaitForSeconds(waitTime);
renderer.enabled = true;
}
this one works, and the next one is
Boo:
import UnityEngine
import System.Collections
//Enemy Script
class scriptEnemy (MonoBehaviour):
//public variables
public numberOfClicks = 2
public waitTime = 2.0
def Start ():
pass
def Update ():
if(numberOfClicks <= 0):
position = Vector3(Random.Range(-7,7),Random.Range(-4,4),0) //random positions between 2 points
respawnTime()
transform.position = position //set the object hit to this new position
numberOfClicks = 2
def respawnTime() as IEnumerator:
print ("respawn called")
print(Time.time)
renderer.enabled = false
yield WaitForSeconds(waitTime)
renderer.enabled = true
print(Time.time)
This one does nothing , the whole respawnTime function/subroutine/method doesn’t get called at all, if I removed the yield line , it gets called fine
Any idea why is this happening ?