// 過時的API、不常用的我就不說了
// auhtor : Jave.Lin
// date : 2018-05-16
public sealed class Application
{
// 可以設置U3D後臺下載線程的:線程優先級,可瞭解DotNet中的線程優先級作用
public static ThreadPriority backgroundLoadingPriority { get; set; }
// build時的GUID,估計可以用於判斷程序合法性
public static string buildGUID { get; }
// 獲取你的App的公司名稱,在:U3D的PlayerSettings中的CompanyName
public static string companyName { get; }
// Assets目錄,注意不用的平臺結果不一(PC,iOS,Android)
public static string dataPath { get; }
// 可檢測安裝模式,如,檢測是否Development build模式,都可以,查看:ApplicationInstallMode枚舉
public static ApplicationInstallMode installMode { get; }
// 可檢測當前網絡是否可用,還有辨別網絡載體類型
public static NetworkReachability internetReachability { get; }
// 判斷當前是否基於U3D 編輯器下運行的
public static bool isEditor { get; }
// 判斷U3D程序是否激活(如:iOS, Android如果有其他程序置頂,
// 處於後臺那麼return false,PC就是沒有程序交互焦點時return false,其他情況return true)
public static bool isFocused { get; }
// 判斷是否在移動平臺在運行
public static bool isMobilePlatform { get; }
// 運行時可讀寫目錄,具體什麼內容,自己到不同平臺下都輸出看看吧
public static string persistentDataPath { get; }
// 返回當前枚舉中的運行時平臺信息,具體看:RuntimePlatform 枚舉定義
public static RuntimePlatform platform { get; }
// 你的發佈程序名稱,在U3D PlayerSettings中的ProductName可設置
public static string productName { get; }
// 還沒用過,估計和:isFocused 差不多
public static bool runInBackground { get; set; }
// 返回運行時的系統語言類型
public static SystemLanguage systemLanguage { get; }
// 可獲取或設置U3D程序的目標幀率,如:設置爲:60,本身可以運行200FPS的,
// 但限制後只會到60,手機端上可節省電量,如果設置:60,運行時小於60FPS,那就儘量優化程序吧,因爲掉幀了
public static int targetFrameRate { get; set; }
// 臨時緩存目錄,具體什麼內容,自己到不同平臺下都輸出看看吧
public static string temporaryCachePath { get; }
// 返回當前運行時的unity版本號
public static string unityVersion { get; }
// 返回你的程序版本號,在PlayerSettings中的Version可設置
public static string version { get; }
// 字面上意思:當收到log日誌消息時觸發的事件
public static event LogCallback logMessageReceived;
// 這個比較有用了,當能用內存量低時會觸發的事件,至於怎麼判斷當前低能用量內存的方式,大家去搜索吧
public static event LowMemoryCallback lowMemory;
// 渲染前的事件?這個沒用過
public static event UnityAction onBeforeRender;
// 有否Pro授權版的
public static bool HasProLicense();
// 在瀏覽器中打開一個URL(之前不知道有這個API,還去了解了Unity for Android/iOS的開發,
// 來調用不同平臺下的瀏覽器來打開URL,好麻煩,現在知道有這個接口就方便多了,
// 不過如果要實現在同一個進程中來打開網頁的話,那麼這個就需要去了解Unity for xxx的開發了,
// 因爲Application.OpenURL是在操作系統的默認瀏覽器來打開的)
public static void OpenURL(string url);
// 手動退出程序
public static void Quit();
// 貌似可用於:攝像頭(圖像驗證)、麥克風(語音驗證)的驗證請求,還沒用過,大家可以試試
public static AsyncOperation RequestUserAuthorization(UserAuthorization mode);
// Quit前,先Unload吧,其實覺得這個API有點雞肋,因爲Application.Quit()是進程級別退出,
// 進程退出的話,那麼之前在這個進程申請的所有資源都會自動回收的(線程、內存、等)
public static void Unload();
}
Unity-Application類常用功能
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.