From 6ded4f8e1a33ce14d1007fa9264eafa2bd22d33d Mon Sep 17 00:00:00 2001 From: mhby1g21 <mhby1g21@soton.ac.uk> Date: Fri, 6 Dec 2024 14:37:13 +0000 Subject: [PATCH] rearranged #if UNITY_EDITOR for importscenery (works in editor but not in build) --- AVVR/Assets/_Scripts/Import Scenery.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AVVR/Assets/_Scripts/Import Scenery.cs b/AVVR/Assets/_Scripts/Import Scenery.cs index 3ea2c20..265b852 100644 --- a/AVVR/Assets/_Scripts/Import Scenery.cs +++ b/AVVR/Assets/_Scripts/Import Scenery.cs @@ -1,22 +1,22 @@ -#if UNITY_EDITOR - using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using Dummiesman; -using UnityEditor.SceneManagement; [ExecuteInEditMode] public class ImportScenery : MonoBehaviour { + #if UNITY_EDITOR [UnityEditor.MenuItem("AVVR/Import Scene")] public static void PerformImport() { try { // hide demo lidar overlay + #if UNITY_EDITOR LoadDemo.ShowLIDAR(false); + #endif } catch (System.Exception e) { @@ -25,13 +25,17 @@ public class ImportScenery : MonoBehaviour // call get new mesh to obtain obj file, then perform import automation ImportScene(GetNewMesh()); + } + #endif public static void ImportScene(GameObject AVVRScene) { if (AVVRScene == null) { + #if UNITY_EDITOR UnityEditor.EditorUtility.DisplayDialog("Import cancelled!", "Invalid file (.obj file required).", "OK"); + #endif } else { @@ -134,6 +138,7 @@ public class ImportScenery : MonoBehaviour } } + #if UNITY_EDITOR static GameObject GetNewMesh() { // starts in default folder for pipeline output @@ -156,6 +161,7 @@ public class ImportScenery : MonoBehaviour return null; } } + #endif public static GameObject GetNewMesh(string objPath, string mtlPath) { @@ -182,5 +188,4 @@ public class ImportScenery : MonoBehaviour // initialise assignmaterial script in new gameobject materialAssigner.Initialise(); } -} -#endif \ No newline at end of file +} \ No newline at end of file -- GitLab