Determine possesable siteLocation at scene load
This commit is contained in:
parent
9f7a96187f
commit
8d7142f3b0
@ -51,7 +51,7 @@ namespace Passer {
|
||||
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName);
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ namespace Passer {
|
||||
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
||||
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName);
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Passer {
|
||||
|
||||
@ -42,20 +43,32 @@ namespace Passer {
|
||||
/// </summary>
|
||||
public bool isUnique = false;
|
||||
|
||||
[SerializeField]
|
||||
private string _siteLocation;
|
||||
public string siteLocation {
|
||||
get {
|
||||
if (_siteLocation == null) {
|
||||
if (_siteLocation == null)
|
||||
DetermineSiteLocation();
|
||||
|
||||
if (SiteNavigator.currentSite == null)
|
||||
_siteLocation = "";
|
||||
|
||||
string siteLocation = SiteNavigator.currentSite.siteLocation;
|
||||
_siteLocation = (siteLocation + "_possessions");
|
||||
}
|
||||
return _siteLocation;
|
||||
}
|
||||
}
|
||||
private void DetermineSiteLocation() {
|
||||
if (SiteNavigator.currentSite == null)
|
||||
_siteLocation = "";
|
||||
else {
|
||||
string siteLocation = SiteNavigator.currentSite.siteLocation;
|
||||
_siteLocation = (siteLocation + "_possessions");
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Awake() {
|
||||
UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
DetermineSiteLocation();
|
||||
}
|
||||
|
||||
public string assetPath;
|
||||
}
|
||||
|
@ -605,7 +605,8 @@ MonoBehaviour:
|
||||
possessionType: 1
|
||||
crossSite: 1
|
||||
isUnique: 1
|
||||
assetPath: Assets/Passer/HumanoidControlFree/Samples/VisitorsAndSites/Sites/AvatarShop/Resources/AutodeskCharity.prefab
|
||||
_siteLocation:
|
||||
assetPath: Packages/com.passervr.humanoidcontrol_free/Samples/VisitorsAndSites/Sites/AvatarShop/Resources/AutodeskCharity.prefab
|
||||
--- !u!114 &2192530470517696406
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1041,6 +1042,7 @@ MonoBehaviour:
|
||||
possessionType: 1
|
||||
crossSite: 1
|
||||
isUnique: 1
|
||||
_siteLocation:
|
||||
assetPath: Packages/com.passervr.humanoidcontrol_free/Samples/VisitorsAndSites/Sites/AvatarShop/Resources/Robot
|
||||
Kyle.prefab
|
||||
--- !u!114 &3076393132243293709
|
||||
@ -1478,6 +1480,7 @@ MonoBehaviour:
|
||||
possessionType: 1
|
||||
crossSite: 1
|
||||
isUnique: 1
|
||||
_siteLocation:
|
||||
assetPath: Packages/com.passervr.humanoidcontrol_free/Samples/VisitorsAndSites/Sites/AvatarShop/Resources/Mixamo.prefab
|
||||
--- !u!114 &3740099460417575030
|
||||
MonoBehaviour:
|
||||
|
Loading…
x
Reference in New Issue
Block a user