Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Suggestion for BroadcastMessage

Discussion in 'Documentation' started by The-Spaniard, Jun 30, 2014.

  1. The-Spaniard

    The-Spaniard

    Joined:
    Jan 7, 2012
    Posts:
    149
    Hello,

    The method BroadcastMessage calls the specified method "on every MonoBehaviour in this game object or any of its children." This should specify that it also means the calling MonoBehaviour. This means that if you are broadcasting a method with the same name as the method you are broadcasting from, that Unity will go into an infinite loop and crash. Not fun. Maybe this is a silly mistake to make, but it is quite an easy one, so it should probably be mentioned in the docs.

    Personally, I think unity should be catching easy to spot infinite loops like this, but in the meantime, a warning in the documentation would be nice.
     
    landon912 likes this.
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
    Ditto for SendMessageUpwards.