Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AVVR-Unity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP Project 4
AVVR-Unity
Commits
6ded4f8e
Commit
6ded4f8e
authored
6 months ago
by
mhby1g21
Browse files
Options
Downloads
Patches
Plain Diff
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
!9
working premade rooms ui, also exportable as .exe (works)
,
!8
added #if UNITY_EDITOR #endif directives to all editor related scripts to...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AVVR/Assets/_Scripts/Import Scenery.cs
+10
-5
10 additions, 5 deletions
AVVR/Assets/_Scripts/Import Scenery.cs
with
10 additions
and
5 deletions
AVVR/Assets/_Scripts/Import Scenery.cs
+
10
−
5
View file @
6ded4f8e
#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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment