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