The total number of frames that have passed (Read Only).
// Makes sure that RecalculateValue only performs // some operations once per frame and no more. static private var lastRecalculation = -1; static function RecalculateValue () { if (lastRecalculation == Time.frameCount) return; // ProcessData.AndDoSomeCalculations(); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { private static int lastRecalculation = -1; static void RecalculateValue() { if (lastRecalculation == Time.frameCount) return; } }
Note: frameCount starts once all Awake functions have finished. The frameCount value will be undefined during Awake functions.