Example #1
0
    public void RebuildMesh(bool forceRefreshMeshData = true)
    {
        UnityEngine.Profiling.Profiler.BeginSample("RebuildMesh");

        if (forceRefreshMeshData || isDirty)
        {
            RefreshMeshData();
        }
        collidable.Refresh();
        notCollidable.Refresh();
        water.Refresh();

        UnityEngine.Profiling.Profiler.EndSample();
    }
Example #2
0
    public void RebuildMesh(UpdateFlags updateFlags = UpdateFlags.All, bool checkBorder = true)
    {
        UnityEngine.Profiling.Profiler.BeginSample("RebuildMesh");

        if (checkBorder)
        {
            CheckBorder();
            CheckNearbyChunks();
        }

        RefreshMeshData(updateFlags);

        try
        {
            InitTileEntity();
            if (updateFlags.HasFlag(UpdateFlags.Collidable))
            {
                collidable.Refresh();
            }
            if (updateFlags.HasFlag(UpdateFlags.NotCollidable))
            {
                notCollidable.Refresh();
            }
            if (updateFlags.HasFlag(UpdateFlags.Water))
            {
                water.Refresh();
            }
        }
        catch (System.Exception e)
        {
            Debug.Log("RebuildMesh chunk=" + x + ",z=" + z);
        }
        //water.Refresh();

        UnityEngine.Profiling.Profiler.EndSample();
    }