I am very new to C# and Itween. How can I make my particle system repeat it’s path as if on a loop? I used a coroutine but it only still seems to play once. I even looked into -“looptype”,iTween.LoopType.pingPong));. However, I’m still confused on how to paraphrase this into my script.
public string pathName;
public float time;
// Use this for initialization
void Start () {
//StartCoroutine (LoopVFX());
iTween.MoveTo( gameObject, iTween.Hash("Path", iTweenPath.GetPath (pathName),"easetype",iTween.EaseType.easeInOutSine, "time", time));
}
//Update is called once per frame
void Update () {
StartCoroutine (LoopLine ());
}
IEnumerator LoopLine (){
int waitWindTime = 10;
int loopCount = 30;
for (int i = 0; i< loopCount; i++){
yield return new WaitForSeconds (waitWindTime);
}
}
}
@Hellium You’ve been a big help and I’m clueless!
I’ve never used iTween
, but, as far as I understand, you can provide a function name, called once your tween ends.
public string pathName;
public float time;
// Use this for initialization
void Start () {
FollowPath();
//StartCoroutine (LoopVFX());
}
//Update is called once per frame
void Update () {
// DON'T START A COROUTINE IN THE UPDATE FUNCTION UNLESS YOU UNDERSTAND WHAT COROUTINES ARE,
// IT STARTS A COROUTINE EVERY FRAME
//StartCoroutine (LoopLine ());
}
IEnumerator LoopLine (){
int waitWindTime = 10;
int loopCount = 30;
for (int i = 0; i< loopCount; i++){
yield return new WaitForSeconds (waitWindTime);
}
}
public void FollowPath()
{
iTween.MoveTo( gameObject, iTween.Hash("Path", iTweenPath.GetPath (pathName),"easetype",iTween.EaseType.easeInOutSine, "time", time, "oncomplete", "FollowPath"));
}