Search Unity

Unet messages broken. Don't arrive at same instance.

Discussion in 'UNet' started by aaron95j, Jan 1, 2016.

  1. aaron95j

    aaron95j

    Joined:
    Dec 9, 2013
    Posts:
    30
    Hello. Please tell me this isn't normal. Messages sent over Unet all arrive at a single object instance of the same type. They do not go to the networked instance of itself.

    make 2 of any object, spawn them over the network, get both instances to send a network message, on the networked computers instance number 2 will receive instance 1 & 2's messages.

    whyyy?
     
  2. aaron95j

    aaron95j

    Joined:
    Dec 9, 2013
    Posts:
    30
    Am I the only one with this issue? o_O
     
  3. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    Message handler functions are global/static. If you register a member function on an instance, then that object will get all the messages.

    If you want to send a message to an object, use a static function and pass a NetworkInstanceId in the message and lookup the object using ClientScene.FindLocalObject or NetworkServer.FindLocalObject.