Hi there,
I’m currently using multiple iTween paths to control my camera’s location. (C# script).
I have two separate functions that handle different ValueTo commands:
public float percentageA = 0f;
public float percentageB = 0f;
public float EasingSpeedA = 1f;
public float EasingSpeedB = 1f;
public GameObject gObjectA;
public GameObject gObjectB;
public Transform [] RailA;
public Transform [] RailB;
void Update()
{
iTween.PutOnPath(gObjectA,RailA,percentageA);
iTween.PutOnPath(gObjectB,RailB,percentageB);
}
public void SlideATo(float position)
{
Debug.Log("B " + position);
iTween.ValueTo(gObjectA,iTween.Hash("from",percentageA,"to",position,"time",EasingSpeedA,"easetype",iTween.EaseType.easeInOutCubic,"onupdate","SlideAPercentage"));
}
void SlideAPercentage(float p)
{
percentageA=p;
}
public void SlideBTo(float position)
{
Debug.Log("B " + position);
iTween.ValueTo(gObjectB,iTween.Hash("from",percentageB,"to",position,"time",EasingSpeedB,"easetype",iTween.EaseType.easeInOutCubic,"onupdate","SlideBPercentage"));
}
void SlideBPercentage(float p)
{
percentageB=p;
}
Now in another script I am calling both the SlideATo and SlideBTo functions at different times, and can even get to the point where both Debug.Log messages can be made to appear; however, for some reason I can get ‘percentageB’ to change using the ValueTo command, but not ‘percentageA’.
Can anybody tell me what I might be doing wrong?