Unity3d sending broadcasts and messages

Source: Internet
Author: User

http://blog.csdn.net/you123you/article/details/8483926

The broadcasts and messages sent between the game objects are divided into three types: the first one is sent to the child object, it is sent to the object's sibling or descendant object, the second is sent to itself, sent to itself, and the third is sent to the parent object, and sent to the object's peers or parents object;

Send a message to the child class,

Gameobject.broadcastmessage ("message", "Broadcastmessage");

Send a message to yourself

Gameobject.sendmessage ("message", "Broadcastmessage");

Send a message to the parent class

Gameobject.sendmessageupwards ("message", "Broadcastmessage");

Receives the message sent by the parent class

function Receivebroadcastmessage (str:string) {

}

Receive messages that you send

Functio Receivesendmessage (str:string) {

}

Receive messages sent by subclasses

function Receivesendmessageupwards (str:string) {

}

Unity3d sending broadcasts and messages

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.