Visitor Scene no longer needs to be in build settings.
This commit is contained in:
parent
1f4e410688
commit
9541a8c4a7
@ -270,7 +270,7 @@ namespace Passer.Humanoid {
|
||||
|
||||
//anyChanged |= NetworkingSettingUI(serializedConfiguration);
|
||||
|
||||
anyChanged |= HumanoidSceneInspector(serializedConfiguration);
|
||||
//anyChanged |= HumanoidSceneInspector(serializedConfiguration);
|
||||
|
||||
return anyChanged;
|
||||
}
|
||||
@ -279,33 +279,33 @@ namespace Passer.Humanoid {
|
||||
|
||||
private static string[] personalHumanoidNames;
|
||||
|
||||
public static bool HumanoidSceneInspector(SerializedObject serializedConfiguration) {
|
||||
bool anyChanged = false;
|
||||
SerializedProperty humanoidSceneNameProp = serializedConfiguration.FindProperty("humanoidSceneName");
|
||||
//public static bool HumanoidSceneInspector(SerializedObject serializedConfiguration) {
|
||||
// bool anyChanged = false;
|
||||
// SerializedProperty humanoidSceneNameProp = serializedConfiguration.FindProperty("humanoidSceneName");
|
||||
|
||||
if (HumanoidVisitors.visitors.Count <= 0)
|
||||
return false;
|
||||
// if (HumanoidVisitors.visitors.Count <= 0)
|
||||
// return false;
|
||||
|
||||
personalHumanoidNames = new string[HumanoidVisitors.visitors.Count];
|
||||
int i = 0;
|
||||
int ix;
|
||||
foreach (string personalHumanoid in HumanoidVisitors.visitors) {
|
||||
string name = personalHumanoid;
|
||||
ix = name.LastIndexOf('/');
|
||||
name = name.Substring(ix + 1);
|
||||
name = name.Substring(0, name.Length - 6); // remove .unity
|
||||
personalHumanoidNames[i++] = name;
|
||||
}
|
||||
// personalHumanoidNames = new string[HumanoidVisitors.visitors.Count];
|
||||
// int i = 0;
|
||||
// int ix;
|
||||
// foreach (string personalHumanoid in HumanoidVisitors.visitors) {
|
||||
// string name = personalHumanoid;
|
||||
// ix = name.LastIndexOf('/');
|
||||
// name = name.Substring(ix + 1);
|
||||
// name = name.Substring(0, name.Length - 6); // remove .unity
|
||||
// personalHumanoidNames[i++] = name;
|
||||
// }
|
||||
|
||||
ix = HumanoidVisitors.visitors.FindIndex(name => name == humanoidSceneNameProp.stringValue);
|
||||
if (ix < 0)
|
||||
ix = 0;
|
||||
ix = EditorGUILayout.Popup("Testing Visitor", ix, personalHumanoidNames);
|
||||
anyChanged = humanoidSceneNameProp.stringValue != HumanoidVisitors.visitors[ix];
|
||||
// ix = HumanoidVisitors.visitors.FindIndex(name => name == humanoidSceneNameProp.stringValue);
|
||||
// if (ix < 0)
|
||||
// ix = 0;
|
||||
// ix = EditorGUILayout.Popup("Testing Visitor", ix, personalHumanoidNames);
|
||||
// anyChanged = humanoidSceneNameProp.stringValue != HumanoidVisitors.visitors[ix];
|
||||
|
||||
humanoidSceneNameProp.stringValue = HumanoidVisitors.visitors[ix];
|
||||
return anyChanged;
|
||||
}
|
||||
// humanoidSceneNameProp.stringValue = HumanoidVisitors.visitors[ix];
|
||||
// return anyChanged;
|
||||
//}
|
||||
|
||||
public static bool OpenVRSettingUI(SerializedObject serializedConfiguration) {
|
||||
bool anyChanged = false;
|
||||
|
@ -20,8 +20,8 @@ namespace Passer {
|
||||
}
|
||||
|
||||
protected virtual void InitializeSiteNames() {
|
||||
HumanoidVisitors.CheckScenes();
|
||||
List<string> humanoidVisitors = HumanoidVisitors.visitors;
|
||||
//HumanoidVisitors.CheckScenes();
|
||||
//List<string> humanoidVisitors = HumanoidVisitors.visitors;
|
||||
|
||||
EditorBuildSettingsScene[] editorBuildSettingsScenes = EditorBuildSettings.scenes;
|
||||
int siteCount = editorBuildSettingsScenes.Length; // - HumanoidVisitors.visitors.Count;
|
||||
|
@ -151,33 +151,15 @@ namespace Passer.Humanoid {
|
||||
|
||||
private static string[] visitorNames;
|
||||
private static bool VisitorSceneInspector() {
|
||||
bool anyChanged = false;
|
||||
string visitorScenePath = HumanoidPreferences.visitorSceneName;
|
||||
|
||||
HumanoidVisitors.CheckScenes();
|
||||
if (HumanoidVisitors.visitors == null || HumanoidVisitors.visitors.Count <= 0)
|
||||
return false;
|
||||
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(visitorScenePath);
|
||||
sceneAsset = (SceneAsset) EditorGUILayout.ObjectField("Visitor Scene", sceneAsset, typeof(SceneAsset), false);
|
||||
visitorScenePath = AssetDatabase.GetAssetPath(sceneAsset);
|
||||
|
||||
visitorNames = new string[HumanoidVisitors.visitors.Count];
|
||||
int i = 0;
|
||||
int ix;
|
||||
foreach (string visitor in HumanoidVisitors.visitors) {
|
||||
string name = visitor;
|
||||
ix = name.LastIndexOf('/');
|
||||
if (ix >= 0) {
|
||||
name = name.Substring(ix + 1);
|
||||
name = name.Substring(0, name.Length - 6); // remove .unity
|
||||
visitorNames[i++] = name;
|
||||
}
|
||||
}
|
||||
bool anyChanged = visitorScenePath != HumanoidPreferences.visitorSceneName;
|
||||
|
||||
string visitorSceneName = HumanoidPreferences.visitorSceneName;
|
||||
ix = HumanoidVisitors.visitors.FindIndex(name => name == visitorSceneName);
|
||||
if (ix < 0)
|
||||
ix = 0;
|
||||
ix = EditorGUILayout.Popup("Default Visitor scene", ix, visitorNames);
|
||||
anyChanged = visitorSceneName != HumanoidVisitors.visitors[ix];
|
||||
|
||||
HumanoidPreferences.visitorSceneName = HumanoidVisitors.visitors[ix];
|
||||
HumanoidPreferences.visitorSceneName = visitorScenePath;
|
||||
|
||||
return anyChanged;
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ namespace Passer {
|
||||
if (humanoid == null) {
|
||||
string visitorScenePath = HumanoidPreferences.visitorSceneName;
|
||||
if (!string.IsNullOrEmpty(visitorScenePath)) {
|
||||
//Debug.Log(visitorSceneName);
|
||||
UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(visitorScenePath, new LoadSceneParameters(LoadSceneMode.Additive));
|
||||
}
|
||||
else
|
||||
|
@ -1,27 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoad]
|
||||
public class HumanoidVisitors {
|
||||
|
||||
public static List<string> visitors = new List<string>();
|
||||
|
||||
static HumanoidVisitors() {
|
||||
CheckScenes();
|
||||
}
|
||||
|
||||
public static void CheckScenes() {
|
||||
EditorBuildSettingsScene[] editorBuildSettingsScenes = EditorBuildSettings.scenes;
|
||||
foreach (EditorBuildSettingsScene editorBuildSettingsScene in editorBuildSettingsScenes) {
|
||||
string localSceneName = editorBuildSettingsScene.path;
|
||||
if (!visitors.Contains(localSceneName)) {
|
||||
visitors.Add(localSceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19899e56fc3dbbe4ca6012685d51f69d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user