Question on Chap 5: isTrigger

Home Forums Books Mastering Unity 2D Game Development Question on Chap 5: isTrigger

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #5405

    First off great book, as an experienced programmer its been great getting deeper into the code and design of applications as i learn Unity and C#. Thank you.

    Second, im having an issue with isTrigger firing from Greybeard and the MessageManager. As best i can tell i have everything setup correctly but i never get the conversation to come up with Greybeard when the hero collides with him. The only work around i found was to add in OnTriggerEnter2D and call ThePlayerIsLeaving on the MessagingClientReceiver. This works, but it seems to defeat the purpose of using Listeners.

    Any idea what I could be doing wrong here?

    Thanks in advance for your time.


    Sounds like you have it set up correctly there.

    You have the following:

    1:A BoxCollider2D on the LeftBorder as instructed on page 148 with the MessagingClientBroadcast script (this tells the messaging manager that the player is trying to leave the scene)

    2: An updated MessagingClientReceiver script attached to the GreyBeard NPC and a conversation component with conversations added to it). So when the broadcast is fired, Greybeard receives it and then this prompts the conversation to start.

    Hmm, re-reading that section again (for about the 100th time) I must admit it’s not as clear as it should be, in fact the collider on Greybeard isn’t even used.

    You could alternately move the MessagingClientBroadcast script to greybeard (not as a trigger collider since the messaging scripts only use Collision at that point)


    Hope that helps.

    Simon (Darkside) Jackson


    Ah! I had things mixed up, i thought the collision with Greybeard was suppose to start the conver. It actually worked the first time i tested in then (thought i did something wrong), so i had removed the receiver off the border. Putting the broadcaster back on the border now fires Greybeards conversation when i hit the border correctly.


Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Mastering Unity 2D Game Development’ is closed to new topics and replies.