Common methods for the Unity editor class

Source: Internet
Author: User

Http://www.cnblogs.com/zhaoqingqing/p/3944718.html

Some of the more commonly used editor functions I have mentioned in the previous blog, so it is not detailed, today, referring to the Unicorn Son (Alex) blog, written very comprehensive, reproduced part of the content come over

Editorapplication main Application class

This class provides access to a number of variables, while providing methods such as save. For example, you can create a new editor script, in its update function, to make notes to do a timed save. So as to avoid unnecessary losses.

This class also provides actions such as creating a new scene, opening a project, and so on.

If you are using Unity3d under the interface, perhaps this class has little meaning. But if you are based on the U3D command line to build a one-click Multi-Platform Publishing scenario. The position of the class is very important. Speaking of the command line, this one day, and we will elaborate. U3d is a powerful tool that can completely replace the self-developed engine. It's powerful both from an automated deployment to a custom tool. The key is to see if you're going to take the time to use it.

Of course, we also use it to do some initialization work when making our own editor tools.

Basehierarchysort

In hierarchy, all objects by default are sorted by first letter. How do I do this if I want to sort by the creation date, or by geographical location, or by object type? This requires the use of basehierarchysort, we can rewrite its compare method, and we add several menus to do the switching. Can make our work very convenient.

Editorutility

A look at the word will know that the goods must provide a lot of global functions, and mostly static. For example, you want to pop up a dialog box that opens a file, or a dialog box to save the file. Or if you want to see whether an object in the scene tree is enable or not, it can be accessed through it. Better yet, he also provides a popup dialog box. You want to do something to let the user choose whether or not to be sure, or to show a about that can make it.

See also: http://game.ceeger.com/Script/EditorUtility/EditorUtility.html

Fileutil File Tool

This class provides a number of file copies, mobile location and other operations, in the command-line mode of automatic deployment when the use of the majority.

Help

In your editor, if you think your text is not enough to express, or if you need a user to query the relevant document, you can use Help, which provides the ability to open the Web address.

Objectpreview Creating a custom preview

This class provides the object data that you currently select. For example, if we just want the selected units to show a preview in the examples above that show the attack and detection range, we can determine this class's target.

You can view the Ngui UISPriteInspector.cs file and preview the sprite.

Tools Tool class, you can customize the editor better

This class provides object bulk lookup functionality, for example, if our tool wants to package a class of objects. Then we can use Findobjectsoftype directly and get all the objects. The tool also provides the ability to instantiate objects.

Common methods for the Unity editor 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.