HideInHierarchy









How do I use Hide In Hierarchy
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PhotonNetwork.cs Copy
974     static PhotonNetwork()
975     {
976         #if UNITY_EDITOR
977         if (!EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode)
978         {
979             //Debug.Log(string.Format("PhotonNetwork.ctor() Not playing {0} {1}", UnityEditor.EditorApplication.isPlaying, UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode));
980             return;
981         }
982
983         // This can happen when you recompile a script IN play made
984         // This helps to surpress some errors, but will not fix breaking
985         PhotonHandler[] photonHandlers = GameObject.FindObjectsOfType(typeof(PhotonHandler)) as PhotonHandler[];
986         if (photonHandlers != null && photonHandlers.Length > 0)
987         {
988             Debug.LogWarning("Unity recompiled. Connection gets closed and replaced. You can connect as 'new' client.");
989             foreach (PhotonHandler photonHandler in photonHandlers)
990             {
991                 //Debug.Log("Handler: " + photonHandler + " photonHandler.gameObject: " + photonHandler.gameObject);
992                 photonHandler.gameObject.hideFlags = 0;
993                 GameObject.DestroyImmediate(photonHandler.gameObject);
994                 Component.DestroyImmediate(photonHandler);
995             }
996         }
997         #endif
998
999         Application.runInBackground = true;
1000
1001         // Set up a MonoBehaviour to run Photon, and hide it
1002         GameObject photonGO = new GameObject();
1003         photonMono = (PhotonHandler)photonGO.AddComponent();
1004         photonGO.name = "PhotonMono";
1005         photonGO.hideFlags = HideFlags.HideInHierarchy;
1006
1007
1008         // Set up the NetworkingPeer and use protocol of PhotonServerSettings
1009         networkingPeer = new NetworkingPeer(photonMono, string.Empty, PhotonNetwork.PhotonServerSettings.Protocol);
1010
1011
1012         // Local player
1013         CustomTypes.Register();
1014     }

HideInHierarchy 123 lượt xem

Gõ tìm kiếm nhanh...