public static void CreateEasyRoads3DObject() { RoadObjectScript[] scrpts = (RoadObjectScript[])FindObjectsOfType(typeof(RoadObjectScript)); if (scrpts.Length >= 1) { EditorUtility.DisplayDialog("Alert", "The Free version supports only one road editor object in the scene!\n\nPlease finalize or delete the current road object or upgrade to the full version before creating a new road object.", "Close"); Selection.activeGameObject = scrpts[0].gameObject; return; } Terrain[] terrains = (Terrain[])FindObjectsOfType(typeof(Terrain)); if (terrains.Length == 0) { EditorUtility.DisplayDialog("Alert", "No Terrain objects found! EasyRoads3D objects requires a terrain object to interact with. Please create a Terrain object first", "Close"); return; } if (NewEasyRoads3D.instance == null) { NewEasyRoads3D window = (NewEasyRoads3D)ScriptableObject.CreateInstance(typeof(NewEasyRoads3D)); window.ShowUtility(); } }
public NewEasyRoads3D() { instance = this; title = "New EasyRoads3D Object"; position = new Rect((Screen.width - 350.0f) / 2.0f, (Screen.height - 130.0f) / 2.0f, 350.0f, 130.0f); minSize = new Vector2(350.0f, 130.0f); maxSize = new Vector2(350.0f, 130.0f); }
public static void CreateEasyRoads3DObject() { Terrain[] terrains = (Terrain[])FindObjectsOfType(typeof(Terrain)); if (terrains.Length == 0) { EditorUtility.DisplayDialog("Alert", "No Terrain objects found! EasyRoads3D objects requires a terrain object to interact with. Please create a Terrain object first", "Close"); return; } if (NewEasyRoads3D.instance == null) { NewEasyRoads3D window = (NewEasyRoads3D)ScriptableObject.CreateInstance(typeof(NewEasyRoads3D)); window.ShowUtility(); } }
public void OnDestroy() { instance = null; }