static void LoadGrid() { var target = GameObject.Find(OBJECT_NAME); if (target != null) { GameObject.DestroyImmediate(target); } var go = new GameObject(OBJECT_NAME); go.hideFlags = HideFlags.DontSave; go.transform.position = Vector3.zero; MapBlockVisualizer mbv = go.AddComponent <MapBlockVisualizer>(); mbv.blockTexture = AssetDatabase.LoadAssetAtPath <Texture2D>(GridResPath + "/red.png"); mbv.emptyTexture = AssetDatabase.LoadAssetAtPath <Texture2D>(GridResPath + "/white.png"); mbv.brushTexture = AssetDatabase.LoadAssetAtPath <Texture2D>(GridResPath + "/brush.png"); }
void OnEnable() { mapBlockVisualizer = target as MapBlockVisualizer; }