Example #1
0
 public static int GetSortingLayerID(string sortingLayer)
 {
     string[] sortingLayerNames = TileEditorUtility.GetSortingLayerNames();
     for (int i = 0; i < sortingLayerNames.Length; ++i)
     {
         if (sortingLayerNames[i] == sortingLayer)
         {
             return(i);
         }
     }
     return(-1);
 }
Example #2
0
        void OnWizardCreate()
        {
            GameObject go      = new GameObject(MapName);
            TileMap    tileMap = go.AddComponent <TileMap>();

            tileMap.MapSize  = new Vector2(MapWidth, MapHeight);
            tileMap.TileSize = new Vector2(TileWidth, TileHeight);
            TileLayer newLayer = TileEditorUtility.CreateLayer(tileMap);

            newLayer.gameObject.hideFlags = HideFlags.HideInHierarchy;
            tileMap.TileLayers            = new List <TileLayer>();
            tileMap.TileLayers.Add(newLayer);
            Undo.RegisterCreatedObjectUndo(go, "Create Tile Map");
            Selection.activeGameObject = go;
        }