private static void MakeTileGridBuilder(SpaceMapGraph map, Shape2Graph shape) { var path = Selection.activeObject == null ? null : AssetDatabase.GetAssetPath(Selection.activeObject); if (string.IsNullOrEmpty(path)) { return; } if (File.Exists(path)) { path = Path.GetDirectoryName(path); } path += "/Grid.prefab"; //Debug.Log(path); //Debug.Log(Application.dataPath); var builder = TileGridBuilder.Create(map, shape, RoundType.Rect); var prefab = PrefabUtility.CreateEmptyPrefab(path); PrefabUtility.ReplacePrefab(builder.gameObject, prefab); Object.DestroyImmediate(builder.gameObject); }
public static TileGridBuilder Create(SpaceMapGraph map, Shape2Graph shape, RoundType roundType) { var go = new GameObject(); var builder = go.AddComponent <TileGridBuilder>(); builder.spaceMapGraph = map; builder.gridShapeGraph = new GridShapeGraph { gridType = GridType.Grid2, shape2Graph = shape }; builder.roundType = roundType; return(builder); }