Hey, guys.
When I run this short script, I’m getting a NullReferenceException error. I have no idea why. The error points to this line in iTween:
if(tweenArguments.Contains("looktarget") && isRunning){
I know it’s the “MoveBy” call, because the other part is working correctly–but no luck with the first bit.
Here’s the script. Any ideas about what I’m doing wrong?
UPDATE: Tried using even a basic MoveBy iTween, and no luck. Is there something wrong with the way I’m calling it from the Start function?
private var moveTime;
private var moveDistance;
private var fadeTime;
function Start()
{
moveTime = Random.Range(3,4);
moveDistance = Random.Range(.1,.3);
fadeTime = Random.Range(1,4);
moveDown();
fadeOut();
}
function moveDown()
{
iTween.MoveBy(gameObject, {"amount" : Vector3(0,-1*moveDistance,0), "time": moveTime, "easetype" : "easeInOutQuad", "oncomplete" : "moveUp", "oncompletetarget" : gameObject});
}
function moveUp()
{
iTween.MoveBy(gameObject, {"amount" : Vector3(0,moveDistance,0), "time": moveTime, "easetype" : "easeInOutQuad", "oncomplete" : "moveDown", "oncompletetarget" : gameObject});
}
function fadeOut()
{
iTween.FadeTo(gameObject, {"alpha" : 0, "time": fadeTime, "easetype" : "easeInOutQuad", "oncomplete" : "fadeIn"});
}
function fadeIn()
{
iTween.FadeTo(gameObject, {"alpha" : 1, "time": fadeTime, "easetype" : "easeInOutQuad", "oncomplete" : "fadeOut"});
}