"Unity_api Analysis" the first Chapter application class

Source: Internet
Author: User

The application class does not contain instance properties and instance methods, and in the script, the run-time data of the program is programmed by invoking the static properties and static methods of the application class directly.

Application static Property: DataPath Property: Data File path public static string datapath{get;}
Application.datapath returns the path to the folder where the program's data files are located (read-only). The return path is a relative path, and the data file save path for different game platforms is different. Application.persistentdatapath returns the path to a persisted data store directory (read-only) and can store persisted data files under this path. The same platform, which calls this property in different programs, returns the same value. Application.streamingaassetspath This property is used to return the cache directory of the stream data, the return path is a relative path, and is suitable for setting up some external data file paths. Application.temporarycachepath This property is used to return a cached directory of temporary data (read-only). For the same platform, different programs call this property, and the return value is the same.  loadedlevel property: Level Index public static int loadedlevel{get;} Application.loadedlevel returns the index value of the current scene Application.loadedlevelname returns the name of the current scene Application.isloadinglevel Is there a scene that is loaded application.levelcount the number of scenes that can be loaded in the game Application.platform the current game's running platform, the return value is the enumeration type application.isplaying Whether the current game is running Application.iseditor game is in Unity edit mode  application class static method: Capturescreenshot Method: screenshot public static void Capturescreenshot (string filename);p ublic static void Capturescreenshot (string filename, int supersize); parameter filename Screenshot file name supersize magnification factor, the default is 0, that is, do not enlarge this method to intercept the current game screen and save as PNG format, the file is saved by default in the root directory, if there is a duplicate file is replaced.  loadleveladditiveasync method: Asynchronously load level public static asynvoperation loadleveladditiveasync (int index);//parameter level index value publicStatic Asynvoperation Loadleveladditiveasync (string levelname);//parameter level name This method is used to asynchronously load the level into the current scene in the background according to the level name. This method simply loads the new level into the current scene, and the original contents of the current scene are not destroyed. Asynvoperation colve = public static asynvoperation loadleveladditiveasync (int index); colve.isdone Whether to load complete colve.progress load Progress  registerlogcallback method: Register delegate public static void Registerlogcallback ( Application.logcallback handler); parameter is the name of the delegate this method is used to register a delegate to invoke the log information   the previous one is relatively simple and careful study of the Registration Commission   The first two test script code colvetast the callback method in the script three parameter types cannot be changed. To satisfy the Application.logcallback parameters   Two scripts are hung under an object. The first what is output from start in the Colve_tast1 script. The second value of the output null COLVESTR output becomes the value of the previous output. Third Colveint Click to see Colvestr in the lower left corner the fourth is naturally the output type.   To test that the value of the COLVESTR output is not the value of the previous log output modify the second script as follows   You can see that the value of COLVESTR becomes a new log to determine the output is the value of the previous log output   

Unity_api parsing Chapter Application class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.