PunSceneSettingsCsPath









How do I use Pun Scene Settings Cs Path
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PunSceneSettings.cs Copy
23     {
24         get
25         {
26             if (!string.IsNullOrEmpty(punSceneSettingsCsPath))
27             {
28                 return punSceneSettingsCsPath;
29             }
30
31             // Unity 4.3.4 does not yet have AssetDatabase.FindAssets(). Would be easier.
32             var result = Directory.GetFiles(Application.dataPath, "PunSceneSettings.cs", SearchOption.AllDirectories);
33             if (result.Length >= 1)
34             {
35                 punSceneSettingsCsPath = Path.GetDirectoryName(result[0]);
36                 punSceneSettingsCsPath = punSceneSettingsCsPath.Replace('\\', '/');
37                 punSceneSettingsCsPath = punSceneSettingsCsPath.Replace(Application.dataPath, "Assets");
38
39                 // AssetDatabase paths have to use '/' and are relative to the project's folder. Always.
40                 punSceneSettingsCsPath = punSceneSettingsCsPath + "/" + SceneSettingsFileName;
41             }
42
43             return punSceneSettingsCsPath;
44         }
45     }
File name: PunSceneSettings.cs Copy
50     {
51         get
52         {
53             if (instanceField != null)
54             {
55                 return instanceField;
56             }
57
58             instanceField = (PunSceneSettings)AssetDatabase.LoadAssetAtPath(PunSceneSettingsCsPath, typeof(PunSceneSettings));
59             if (instanceField == null)
60             {
61                 instanceField = ScriptableObject.CreateInstance();
62                 AssetDatabase.CreateAsset(instanceField, PunSceneSettingsCsPath);
63             }
64
65             return instanceField;
66         }
67     }

PunSceneSettingsCsPath 117 lượt xem

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