(22) unity4.6 Learning Ugui Chinese document-------Interactive-eventsystem & Binding

Source: Internet
Author: User

Hello, I am Sun Guangdong. Reprint Please specify source:http://write.blog.csdn.net/postedit/38922399

for more full content please see my game Bull address: http://www.unitymanual.com/forum.php?mod=guide&view=my

Complete Tutorial:http://www.unitymanual.com/thread-26665-1-1.html
5.4 eventsystem& Binding

These two things have different uses and there is nothing comparable, but also to distinguish the better.

Binding

The interacting component contains such as the following :

button in the middle Button of the Binding For example, the following:

among the switches Toggle , sliding block Slider , scroll bar Scrollbar of the Binding For example, the following:

The settings for the top two images are actually very easy.

so-called Binding is to change the state of the current component and the properties within the component on other objects or Public function () the binding. and function () can be understood as an event handler, which can be a method within a system component, or a method in a user-defined script. The status change of this component is caused by the user's input operation.

For example: is a slider, we want to drag the slider during the process, the current value of the slider can be displayed on the Label .

settings such as the following: Label object onto the slider component.

then choose the function that follows. let's look at the components of the Label object first.

Then we'll click on the button to select the function. Show Demo Sample For example the following

yes, we clicked.1Place, pop up the2Content , the content is very obvious,Gameobjectis that every object must be here to representLabelitself, thenRecttransform,Showslidervalue (scripts that you define yourself),Canvasrenderer,Textis thatLabelfour components on the object! These five are the corresponding five classes or scripts.

and then every one of them 2 the items in the list also include different 3.

3 The content we can view: Unity Editor ->window->scriptingreference For example in the following:

these UI classes naturally have 3 definition of the.

EventSystem

The preceding is also introduced, here no more narration. Both interactive and displayed component objects are able to receive input from the user and are completed through the event system.

For example, the official Demo in the Drag and Drop scenario, two script files DragMe.cs and the DropMe.cs file.

The main point is that you want the Image component (non-interactive) object to receive the mouse input and then respond.






(22) unity4.6 Learning Ugui Chinese document-------Interactive-eventsystem & Binding

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.