(5) unity4.6Ugui Chinese Document ------- overview-UGUI Interaction Components, unity4.6ugui-ugui

Source: Internet
Author: User

(5) unity4.6Ugui Chinese Document ------- overview-UGUI Interaction Components, unity4.6ugui-ugui
Zookeeper

Hello everyone, I am Sun Guangdong. Reprinted please indicate the source: http://write.blog.csdn.net/postedit/38922399

More comprehensive content please see my game pretty cool address: http://www.unitymanual.com/forum.php? Mod = guide & view = my

4. Interaction Components

This section covers components in the UI system that process interactions, such as mouse or touch events and interactions with a keyboard or controller.

4.1 Selectable BaseClass

All InterAction components have something in common. Selectables is the base class of all their controls, which means they all have a shared state, forward-looking conversion between and navigation to other built-in features using the keyboard or controller selectables. This sharing function is described here.

There are several transition options in a selectable component to select the current status. Different statuses are normal, highlighted by highlighted, pressed by pressed, and disabled by disabled.

Here is the transition option:

  • Color Tint-is used to change the Color based on the status of the button. Each status can correspond to a Color. It is also possible to set the Fade Duration between different States. The higher the value, the slower the fade-in and fade-out colors.

  • SpriteSwap-you can customize the display of the Image Based on the status of the button.

  • Animation-different animations are executed based on the status of the button. The animation transition is available only when the animation or component exists. It is important to make sure that the root movement is disabled. To create an animation controller, click the animation component that generates an animation (or you create it yourself) and make sure that the animation controller has been added to the button. For more information, see Animation Integration.

  • None-this option does not affect the status of the button at all.

 

The Navigation option refers to how the uGUI element in playback mode controls Navigation.

4.2 Button

The button has an OnClick function to define what the button will do when it is clicked. In the lower right corner is a symbol of '+'. You need to add a delegate;

The first step is to select an object and its function is required.

The next step is to select a function.

The last step is based on the variables in the selected function.

The tag appended to the button has a Text component that separates the tag from the button, allowing more freedom in design and customization. It allows you to set the displayed text, Font, Font Style, font size, text color, and whether to enable the format text format.

4.3 Toggle

The Toggle switch has a Rect Transform component, an Image component, and a Toggle switch component. It also has a sub-object Label attached to it, and the Label has a Rect Transform component and a Text component. The Toggle switch has an additional sub-game object Image called the Background. It sets the Background of the toggle switch, and its own sub-object Image game object called Checkmark to display toggle to the selected or unselected.

Toggle Group

Is OnCheck whether the check box is currently on or off.

Toggle TransitionThe options for toggle activation and non-activation between Fade are provided.

The graphic option is used to change the background to a more appropriate image. If ColorTint is selected, the color changes.

There is also an optionOn Value ChangedDefines what to do if you select to switch. In the lower right corner is a symbol of '+'. You need to add a delegate:

The first step is to select an object and its function is required.

The next step is to select a function.

The last step is used based on the variables in the selected function.

4.4 Toggle Group

YesToggle GroupA switch group is a group of switches. If the switch belongs to the same group, the constraint is that only one switch is selected at a time. When one switch is selected, all others are automatically deselected.

Look at a switch in the switch group.

Toggle Group

The Toggle Group switching Group is setup. Drag the switching Group object to the Group attribute of the switch. Any user who switches to a group can select from a list of mutually exclusive projects.

4.5 Slider

The Slider game object can be vertical or horizontal. It has a child object attached to it called Fill Area, and also has a child object attached to it called filled. Therefore, it cannot exceed the boundary of the slider game object. The transformed value of the filled game object is driven by its parent's transformed value.

The value increase direction can be set as a horizontal slider, left to right or from right to left or up or down for a vertical scroll bar.

The minimum and maximum fields in the Min and Max values that can be set. If the entire Numbers number option is selected, the slider will only move up or down when the value is an integer. The value is the current value where the slider is located.

It can also be used to add scripts. When the slider Value is Changed, it can be customized in the field On Value Changed.

4.6 Scrollbar

The scroll bar game object can be vertical or horizontal. It has a child object appended to it called the Background, a child appended to it called the Sliding Area, and a child named Handle sub-object. The transformation value of a Handle game object is driven by the transformation value of its parent object. Therefore, it cannot exceed the boundary of a game object on the scroll bar.

 

Handle Rect defines what the slider will look like. By default, it is set as a sub-game object called Handle. The value increase direction can be set to left-to-right or from right to left as a horizontal scroll bar, or a vertical scroll bar at the bottom and bottom.

You can use the Value field to set the start of the scroll bar Value. You can change the Size of the scroll bar in the Size field. You can also use the 'number of steps' field to set the value of the scroll bar, for example, 3. Step means that the scroll bar displays 0%, 50%, 100%.

It is also possible that when the Value of the scroll bar is Changed, it can customize the script adding behavior when the On Value in the field is Changed.

4.7 Scroll Rect

Scroll Rect is used to display a large image or a large group of UI controls in a small area. Scroll Rect provides functions that use or do not use Scroll bars in images or other UI elements. Generally, it is combined with the parent object Rect Transform on the Mask and Image to create a rolling view, where only the scrolling content of the internal Scroll Rect is visible.

In Hierarchy, things are arranged like this: RectTransform and Rect Transform also have a Mask component for it. The image of the following object is called the ScrollView rolling view.

As a child to ScrollView, the scroll view should be a single RectTransform, which can be used as the parent level of all the scrollable content. The following image is called Content. All the UI elements that can be rolled should be the sub-level of the object's Content. The Content object should also be dragged into the Content attribute of the Scroll Rect component.

(Optional). A rolling Rect can be linked to a horizontal or vertical scroll bar. These are usually placed in the hierarchy as siblings to the scroll view, and when they appear, they should be dragged into the horizontal scroll bar and the scroll Rect attribute of the vertical scroll bar respectively. Note that you should set the attribute to the vertical scroll bar from left to right to the bottom to the top of the horizontal scroll bar.

4.8 Input Field

The input field is used to edit the text of the text control.

 

Zookeeper


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.