Skip to content
Snippets Groups Projects
Commit 6ded4f8e authored by mhby1g21's avatar mhby1g21
Browse files

rearranged #if UNITY_EDITOR for importscenery (works in editor but not in build)

parent 15f44028
No related branches found
No related tags found
2 merge requests!9working premade rooms ui, also exportable as .exe (works),!8added #if UNITY_EDITOR #endif directives to all editor related scripts to...
#if UNITY_EDITOR
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
using Dummiesman; using Dummiesman;
using UnityEditor.SceneManagement;
[ExecuteInEditMode] [ExecuteInEditMode]
public class ImportScenery : MonoBehaviour public class ImportScenery : MonoBehaviour
{ {
#if UNITY_EDITOR
[UnityEditor.MenuItem("AVVR/Import Scene")] [UnityEditor.MenuItem("AVVR/Import Scene")]
public static void PerformImport() public static void PerformImport()
{ {
try try
{ {
// hide demo lidar overlay // hide demo lidar overlay
#if UNITY_EDITOR
LoadDemo.ShowLIDAR(false); LoadDemo.ShowLIDAR(false);
#endif
} }
catch (System.Exception e) catch (System.Exception e)
{ {
...@@ -25,13 +25,17 @@ public class ImportScenery : MonoBehaviour ...@@ -25,13 +25,17 @@ public class ImportScenery : MonoBehaviour
// call get new mesh to obtain obj file, then perform import automation // call get new mesh to obtain obj file, then perform import automation
ImportScene(GetNewMesh()); ImportScene(GetNewMesh());
} }
#endif
public static void ImportScene(GameObject AVVRScene) public static void ImportScene(GameObject AVVRScene)
{ {
if (AVVRScene == null) if (AVVRScene == null)
{ {
#if UNITY_EDITOR
UnityEditor.EditorUtility.DisplayDialog("Import cancelled!", "Invalid file (.obj file required).", "OK"); UnityEditor.EditorUtility.DisplayDialog("Import cancelled!", "Invalid file (.obj file required).", "OK");
#endif
} }
else else
{ {
...@@ -134,6 +138,7 @@ public class ImportScenery : MonoBehaviour ...@@ -134,6 +138,7 @@ public class ImportScenery : MonoBehaviour
} }
} }
#if UNITY_EDITOR
static GameObject GetNewMesh() static GameObject GetNewMesh()
{ {
// starts in default folder for pipeline output // starts in default folder for pipeline output
...@@ -156,6 +161,7 @@ public class ImportScenery : MonoBehaviour ...@@ -156,6 +161,7 @@ public class ImportScenery : MonoBehaviour
return null; return null;
} }
} }
#endif
public static GameObject GetNewMesh(string objPath, string mtlPath) public static GameObject GetNewMesh(string objPath, string mtlPath)
{ {
...@@ -182,5 +188,4 @@ public class ImportScenery : MonoBehaviour ...@@ -182,5 +188,4 @@ public class ImportScenery : MonoBehaviour
// initialise assignmaterial script in new gameobject // initialise assignmaterial script in new gameobject
materialAssigner.Initialise(); materialAssigner.Initialise();
} }
} }
#endif \ No newline at end of file
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment