Unity Mobile Game Development: Communication with Notification Center
Unity移动手机游戏开发:通信与通知中心
1 hrs. 25 min. | January 2, 2012 | Unity 3.4 | Author: Chris Glick
In this Unity tutorial, we’ll learn various ways our scripts can access and talk to each other. We'll begin the tutorial by learning about all the built-in methods Unity gives us to talk between scripts and between objects.
在这种统一教程,我们将学习各种方法,我们的脚本可以访问,并互相交谈。我们将开始对所有内置的方法统一,使我们之间谈脚本和对象之间的学习教程。
We'll learn the how to find and access scripts on any game object using either direct connections, finding the object or the physics system. Finally we'll examine how a script can call methods on many other scripts using the messaging system in Unity. Each of these methods has limitations, so next we'll introduce the 3rd party script 'Notification Center' which acts as a central hub for easily communicating between multiple scripts.
我们将学习如何找到和访问脚本在任何游戏中使用直接连接的对象,找到对象或物理系统。最后,我们将探讨如何脚本可以调用方法使用统一消息系统的许多其他脚本。这些方法都具有局限性,因此,下一步我们将引入第三方脚本“通知中心”,作为一个中心枢纽的作用,容易多个脚本之间的沟通。
We'll learn how to post a new notification, how to observe a notification and how to pass data through the Notification Center. We'll wrap everything up by examining each of these methods and discuss which we should use in various situations. Understanding how our scripts will talk to each other lets us break our game into many script components, while still creating the functionality we need with the least amount of effort.
我们将学习如何将一个新的通知后,如何观察一个通知,以及如何通过通知中心的数据。我们将总结通过检查这些方法和讨论,我们应该在不同情况下使用。了解我们的脚本将如何互相交谈,让我们打入许多脚本组件我们的游戏,同时还创造的功能,我们需要用最少的努力。