Game Development Reference
In-Depth Information
is important because it tells who should receive this collectable, in case there are multiple
collectors in the game.
The question now is: who is going to receive the message Collected , which has been sent
by Collectable script? The answer is: all scripts attached to the same game object of Col-
lectable . We are going to see how to receive this message and how to write an appropriate
logic to handle it. Therefore, the only job for Collectable is to tell other scripts that the
object has collided with a collector. Notice that we use SendMessageOptions.RequireRe-
ceiver , which requires that at least one script receive this message, otherwise an error is
raised. We require a receiver for this message since a collectable that does not include any
other logic does not make sense.
Search WWH ::




Custom Search