DemoHub
How do I use Demo Hub
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
14 | "DemoHub/DemoHub-Scene.unity", | 1 |
49 | LoadPunDemoHub(); | 2 |
68 | public static void LoadPunDemoHub() | 3 |
File name: PunStartup.cs
Copy
10 // paths to demo scenes to setup (if needed)
13 {
14 "DemoHub/DemoHub-Scene.unity",
15 "DemoBoxes/DemoBoxes-Scene.unity",
16 "DemoWorker/DemoWorker-Scene.unity",
17 "DemoWorker/DemoWorkerGame-Scene.unity",
18 "MarcoPolo-Tutorial/MarcoPolo-Scene.unity",
19 "DemoSynchronization/DemoSynchronization-Scene.unity",
20 "DemoFriendsAndCustomAuth/DemoFriends-Scene.unity",
21 "DemoFriendsAndCustomAuth/DemoPickup-Scene.unity",
22 "DemoChat/DemoChat-Scene.unity"
23 };
File name: PunStartup.cs
Copy
34 static void OnUpdate()
35 {
36 bool doneBefore = EditorPrefs.GetBool("PunDemosOpenedBefore");
37 if (doneBefore)
38 {
39 EditorApplication.update -= OnUpdate;
40 return;
41 }
42
43 if (String.IsNullOrEmpty(EditorApplication.currentScene) && EditorBuildSettings.scenes.Length == 0)
44 {
45 #if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
46 if (EditorApplication.isUpdating) return;
47 #endif
48
49 LoadPunDemoHub();
50 SetPunDemoBuildSettings();
51 EditorPrefs.SetBool("PunDemosOpenedBefore", true);
52 Debug.Log("No scene was open. Loaded PUN Demo Hub Scene and added demos to build settings. Ready to go! This auto-setup is now disabled in this Editor.");
53 }
54 }
File name: PunStartup.cs
Copy
68 public static void LoadPunDemoHub()
69 {
70 bool ret = EditorApplication.OpenScene(demoBasePath + demoPaths[0]);
71 if (ret)
72 {
73 Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(demoBasePath + demoPaths[0]);
74 }
75 }
DemoHub 118 lượt xem
Gõ tìm kiếm nhanh...