public static void Initialize()
        {
            UnityEngine.Object[] cacheFiles = Resources.LoadAll("PrefabCache", typeof(PrefabCache));
            if (cacheFiles != null && cacheFiles.Length > 0)
            {
                if (cacheFiles.Length > 1)
                {
                    Debug.LogWarning("There are more than one PrefabCache files in 'Resources' folder. Check your project to keep only one.");
                }
                PrefabCache cache = (PrefabCache)cacheFiles [0];
                for (int i = 0; i < cache.prefabs.Count; i++)
                {
                    if (!PhotonNetwork.PrefabCache.ContainsKey(cache.prefabs [i].name))
                    {
                        PhotonNetwork.PrefabCache.Add(cache.prefabs [i].name, cache.prefabs [i].prefab);
                    }

                    if (!NetworkingPeer.PrefabCache.ContainsKey(cache.prefabs [i].name))
                    {
                        NetworkingPeer.PrefabCache.Add(cache.prefabs [i].name, cache.prefabs [i].prefab);
                    }
                }
            }
            else
            {
                Debug.LogWarning("Loading PrefabCache failed. PrefabCache asset must be in any 'Resources' folder as: PrefabCache");
            }
        }
        private void Update()
        {
            if (cache == null && !EditorApplication.isCompiling)
            {
                cache = (PrefabCache)Resources.Load("PrefabCache");
                if (cache == null)
                {
                    if (!System.IO.Directory.Exists(Application.dataPath + "/ICode/Scripts/Photon Support/Resources"))
                    {
                        AssetDatabase.CreateFolder("Assets/ICode/Scripts/Photon Support", "Resources");
                    }
                    cache = ICode.FSMEditor.AssetCreator.CreateAsset <PrefabCache>("Assets/ICode/Scripts/Photon Support/Resources/PrefabCache.asset");
                    EditorUtility.DisplayDialog("Created PrefabCache!",
                                                "Do not delete or rename the Resource folder and the PrefabCache asset.", "Ok");
                }
                return;
            }

            if (cache != null)
            {
                if (cache.prefabs == null)
                {
                    cache.prefabs = new List <PrefabCache.PrefabInstance> ();
                }

                if (cache.prefabs.Count == 0 || cache.prefabs [cache.prefabs.Count - 1].prefab != null)
                {
                    cache.prefabs.Add(new PrefabCache.PrefabInstance());
                }
            }
        }