Support Forum

Updating Grid Graph for Doors

I have this small script to scan the grid ever couple seconds. I’m using for any movable objects and doors. It was working yesterday and now has stopped working. It won’t scan ever. Anything I’m doing wrong?

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

public class GridScan : MonoBehaviour
{
    private float nextActionTime = 0.0f;
    public float period = 0.1f;

    // Update is called once per frame
    void Update()
    {
        
        if (Time.time > nextActionTime)
        {
            nextActionTime += period;
            AstarPath.active.Scan();
            Debug.Log("ScanComplete");
        }
    }
}

Hi

Your script looks perfectly fine to me.