public static GameObject Instantiate(string prefabName, Vector3 position, Quaternion rotation, int group, object[] data)
{
if (!connected || (InstantiateInRoomOnly && !inRoom))
{
Debug.LogError("Failed to Instantiate prefab: " + prefabName + ". Client should be in a room. Current connectionStateDetailed: " + connectionStateDetailed);
return(null);
}
if (!UsePrefabCache || !PrefabCache.TryGetValue(prefabName, out GameObject value))
{
value = ((!prefabName.StartsWith("RCAsset/")) ? ((GameObject)Resources.Load(prefabName, typeof(GameObject))) : FengGameManagerMKII.InstantiateCustomAsset(prefabName));
if (UsePrefabCache)
{
PrefabCache.Add(prefabName, value);
}
}
if (value == null)
{
Debug.LogError("Failed to Instantiate prefab: " + prefabName + ". Verify the Prefab is in a Resources folder (and not in a subfolder)");
return(null);
}
if (value.GetComponent <PhotonView>() == null)
{
Debug.LogError("Failed to Instantiate prefab:" + prefabName + ". Prefab must have a PhotonView component.");
return(null);
}
Component[] photonViewsInChildren = value.GetPhotonViewsInChildren();
int[] array = new int[photonViewsInChildren.Length];
for (int i = 0; i < array.Length; i++)
{
array[i] = AllocateViewID(player.Id);
}
Hashtable evData = networkingPeer.SendInstantiate(prefabName, position, rotation, group, array, data, isGlobalObject: false);
return(networkingPeer.DoInstantiate2(evData, networkingPeer.mLocalActor, value));
}