private void Awake()
    {
        if (!instance)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(this.gameObject);
    }
예제 #2
0
    protected override void Awake()
    {
        base.Awake();

        //Инициализация контейнеров, чтобы они не инициализировались при вызовах в runtime и не уменьшали FPS
        GameObjectContainers.InitAllContainers();

        NodeSize         = AstarPath.active.astarData.gridGraph.nodeSize;
        HalfNodeSizeSqrt = (float)Math.Round(Mathf.Sqrt(NodeSize * 0.5f), 2);
        //print(_sqrtHalfNodeSize);

        InitPlayers();
        InitLayerFields();
    }