Invoke Repeating Not Working

Hi,
I just wrote this script to call the two shown functions at various different times however it is always only calling the ‘ChangeAngleBack’ function and never the other one and I cant figure out why, please could somebody help me with this. The purpose of the script is the to flip the force angle of the Area Effector 2D every 2 seconds.

The Script is :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RandomiseMovement : MonoBehaviour
{
    AreaEffector2D af2D;

    // Start is called before the first frame update
    void Start()
    {
        af2D = GetComponent<AreaEffector2D>();
        InvokeRepeating("ChangeAngleBack", 0.0f, 2.0f);
        InvokeRepeating("ChangeAngle", 2.0f, 2.0f);
    }

    void ChangeAngle ()
    {
        af2D.forceAngle = 0;
    }

    void ChangeAngleBack ()
    {
        af2D.forceAngle = -180;
    }
}

Many Thanks,
Josh :slight_smile:

The purpose of the script is the to flip the force angle of the Area Effector 2D every 2 seconds.

Then, your delays are wrong…

 void Start()
 {
     af2D = GetComponent<AreaEffector2D>();
     InvokeRepeating("ChangeAngleBack", 0.0f, 4.0f);
     InvokeRepeating("ChangeAngle", 2.0f, 4.0f);
 }