Fix loading wrong Possession
This commit is contained in:
parent
7d41944b98
commit
075a5d7ba1
@ -156,17 +156,21 @@ namespace Passer.Humanoid {
|
||||
|
||||
if (humanoid.remoteAvatar == null) {
|
||||
Possessable avatarPossessable = humanoid.avatarRig.GetComponent<Possessable>();
|
||||
if (avatarPossessable != null)
|
||||
if (avatarPossessable != null) {
|
||||
possessionLocation = avatarPossessable.siteLocation;
|
||||
|
||||
avatarPrefabName = humanoid.avatarRig.name; // .Substring(0, humanoid.avatarRig.name.Length - 7);
|
||||
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 = humanoid.remoteAvatar.name;
|
||||
avatarPrefabName = avatarPossessable.assetPath;
|
||||
}
|
||||
else
|
||||
avatarPrefabName = humanoid.remoteAvatar.name;
|
||||
}
|
||||
|
||||
#if RemoteAvatarBundles
|
||||
@ -291,7 +295,7 @@ namespace Passer.Humanoid {
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject remoteAvatar = (GameObject)Resources.Load(msg.avatarPrefabName);
|
||||
if (remoteAvatar == null) {
|
||||
@ -1545,7 +1549,7 @@ namespace Passer.Humanoid {
|
||||
if (msg.possessionLocation != null) {
|
||||
Debug.Log("Need to download avatar possession from " + msg.possessionLocation);
|
||||
HumanoidPlayer.instance.StartCoroutine(
|
||||
VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName,
|
||||
VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName,
|
||||
retrievedAvatar => ProcessRetrievedAvatar(networking, remoteHumanoid, retrievedAvatar))
|
||||
);
|
||||
return;
|
||||
|
@ -49,7 +49,7 @@ namespace Passer {
|
||||
get {
|
||||
if (_siteLocation == null)
|
||||
DetermineSiteLocation();
|
||||
|
||||
|
||||
return _siteLocation;
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ namespace Passer {
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
if (_siteLocation == null)
|
||||
if (string.IsNullOrEmpty(_siteLocation))
|
||||
DetermineSiteLocation();
|
||||
}
|
||||
|
||||
|
@ -314,12 +314,14 @@ namespace Passer {
|
||||
string possessableName = possessablePath;
|
||||
int lastSlashIx = possessablePath.LastIndexOf('/');
|
||||
if (lastSlashIx >= 0)
|
||||
possessableName = possessablePath.Substring( + 1);
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user