Ejemplo n.º 1
0
    public static void SetTargetFrameRate(int frameRate)
    {
        if (frameRate == 0)
        {
            if (singleton != null)
            {
                DestroyImmediate(singleton);
                singleton = null;
            }

            targetDeltaTicks = 0;
            return;
        }

        targetDeltaTicks = Mathf.RoundToInt(1000f / frameRate + BONUS_TICKS);

        if (singleton != null)
        {
            return;
        }

        var go = new GameObject("TargetFrameRateFix");

        go.AddComponent <TargetFrameRateFix>();
        go.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.NotEditable;
    }
Ejemplo n.º 2
0
    void Awake()
    {
        if (singleton != null)
        {
            DestroyImmediate(this);
            return;
        }

        singleton = this;

        DontDestroyOnLoad(this);

        prevTicksSinceStartup = timeGetTime();
    }
	void Awake()
	{
		if (singleton != null)
		{
			DestroyImmediate(this);
			return;
		}

		singleton = this;

		DontDestroyOnLoad(this);

		prevTicksSinceStartup = timeGetTime();
	}
	public static void SetTargetFrameRate(int frameRate)
	{
		if (frameRate == 0)
		{
			if (singleton != null)
			{
				DestroyImmediate(singleton);
				singleton = null;
			}

			targetDeltaTicks = 0;
			return;
		}

		targetDeltaTicks = Mathf.RoundToInt(1000f / frameRate + BONUS_TICKS);
		
		if (singleton != null) return;
		
		var go = new GameObject("TargetFrameRateFix");
		go.AddComponent<TargetFrameRateFix>();
		go.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.NotEditable;
	}