Pavan K
Pavan K

Reputation: 4693

InvokeRepeating not working in unity with .Net 4.6

I attached the below script to the camera

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sample : MonoBehaviour {

    int i=0;

    void Start () { 
        Debug.Log("This is printed immediately");
        Debug.Log("Called invoke repating ");
        InvokeRepeating("test", 0.0f, 0.5f);
    }

    void test()
    {
        i++;
        Debug.Log("Called invoke repating "+i);
    }

    void Update () {
    }
}

this is what i get in my console (it stops and doesn't get invoked repeatedly):

This is printed immediately
UnityEngine.Debug:Log(Object)
Sample:Start() (at Assets/Sample.cs:27)
Called invoke repating 
UnityEngine.Debug:Log(Object)
Sample:Start() (at Assets/Sample.cs:28)
Called invoke repating 1
UnityEngine.Debug:Log(Object)
Sample:test() (at Assets/Sample.cs:36)

Does anyone have a clue what is going on... I can't seem to spot any mistake here.

Screenshot - enter image description here

Upvotes: 1

Views: 310

Answers (1)

Pavan K
Pavan K

Reputation: 4693

This worked -

Go to Edit > Project Settings > Time

Timescale has to be 1

Upvotes: 1

Related Questions