GreedyVox
Active member
Hi Justin,
Reporting a Bug I found in the PunUtility.cs with the funcion RetrieveGameObject, return null GameObject when the variable itemSlotID == -1
I fixed this for myself and sharing
Reporting a Bug I found in the PunUtility.cs with the funcion RetrieveGameObject, return null GameObject when the variable itemSlotID == -1
ObjectIdentifier objectIdentifier = null;
if (!idObjectIDMap.TryGetValue(id, out objectIdentifier)) {
// The ID doesn't exist in the cache. Try to find the object.
var hitPhotonView = PhotonNetwork.GetPhotonView((int)id);
if (hitPhotonView != null) {
gameObject = hitPhotonView.gameObject;
} else {
// The object isn't a PhotonView. It could be an ObjectIdentifier.
var objectIdentifiers = parent == null ? GameObject.FindObjectsOfType<ObjectIdentifier>() : parent.GetComponentsInChildren<ObjectIdentifier>();
if (objectIdentifiers != null) {
for (int i = 0; i < objectIdentifiers.Length; ++i) {
if (objectIdentifiers.ID == id) {
objectIdentifier = objectIdentifiers;
break;
}
}
}
idObjectIDMap.Add(id, objectIdentifier);
if (objectIdentifier != null) {
gameObject = objectIdentifier.gameObject;
}
}
}
I fixed this for myself and sharing
ObjectIdentifier objectIdentifier = null;
if (!idObjectIDMap.TryGetValue (id, out objectIdentifier)) {
// The ID doesn't exist in the cache. Try to find the object.
SpawnManager.SpawnedObjects.TryGetValue (id, out var hitPhotonView);
if (hitPhotonView != null) {
gameObject = hitPhotonView.gameObject;
} else {
// The object isn't a PhotonView. It could be an ObjectIdentifier.
var objectIdentifiers = parent == null ? GameObject.FindObjectsOfType<ObjectIdentifier> () :
parent.GetComponentsInChildren<ObjectIdentifier> ();
if (objectIdentifiers != null) {
for (int i = 0; i < objectIdentifiers.Length; ++i) {
if (objectIdentifiers.ID == id) {
objectIdentifier = objectIdentifiers;
break;
}
}
}
idObjectIDMap.Add (id, objectIdentifier);
}
}
if (objectIdentifier != null) { gameObject = objectIdentifier.gameObject; }
Last edited: