Fix loading wrong Possession

This commit is contained in:
Pascal Serrarens 2022-02-22 13:32:04 +01:00
parent 7d41944b98
commit 075a5d7ba1
3 changed files with 19 additions and 13 deletions

View File

@ -156,16 +156,20 @@ namespace Passer.Humanoid {
if (humanoid.remoteAvatar == null) {
Possessable avatarPossessable = humanoid.avatarRig.GetComponent<Possessable>();
if (avatarPossessable != null)
if (avatarPossessable != null) {
possessionLocation = avatarPossessable.siteLocation;
avatarPrefabName = avatarPossessable.assetPath;
}
else
avatarPrefabName = humanoid.avatarRig.name; // .Substring(0, humanoid.avatarRig.name.Length - 7);
}
else {
Possessable avatarPossessable = humanoid.remoteAvatar.GetComponent<Possessable>();
if (avatarPossessable != null)
if (avatarPossessable != null) {
possessionLocation = avatarPossessable.siteLocation;
avatarPrefabName = avatarPossessable.assetPath;
}
else
avatarPrefabName = humanoid.remoteAvatar.name;
}

View File

@ -67,7 +67,7 @@ namespace Passer {
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
if (_siteLocation == null)
if (string.IsNullOrEmpty(_siteLocation))
DetermineSiteLocation();
}

View File

@ -316,10 +316,12 @@ namespace Passer {
if (lastSlashIx >= 0)
possessableName = possessablePath.Substring(+1);
Debug.Log("Load: " + possessablePath);
possessableName = possessableName.ToLower();
Debug.Log("Load: " + possessableName);
prefab = assetBundle.LoadAsset<GameObject>(possessableName);
if (prefab == null) {
Debug.LogError("Could not load " + possessablePath);
Debug.LogError("Could not load " + possessableName);
yield break;
}