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.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)
{
......@@ -183,4 +189,3 @@ public class ImportScenery : MonoBehaviour
materialAssigner.Initialise();
}
}
\ No newline at end of file
#endif
\ 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