Search Unity

Unet message going to wrong instance

Discussion in 'UNet' started by aaron95j, Nov 18, 2015.

  1. aaron95j

    aaron95j

    Joined:
    Dec 9, 2013
    Posts:
    30
    Hi,

    Sending a message with UNet doesn't seem to arrive at the same target instance on the clients?

    I would have thought if you send a message from an instance it will be received by the same instance on the other end? please tell me this isn't normal.

    I am writing the gameObjects name to the message and at the other end it doesn't match the receiving gameObject. Ideas?
     
    Last edited: Nov 26, 2015
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    "name"? To identify an object over the network use netId.
     
  3. aaron95j

    aaron95j

    Joined:
    Dec 9, 2013
    Posts:
    30
    Yes, name. NetID would work too but if the receiving gameobject is of a different instance both options will detect it.

    PrefabOne sends a message PrefabTwo receives it? The behaviour is inconsistent, sometimes it doesnt happen. The objects are spawned.
     
  4. aaron95j

    aaron95j

    Joined:
    Dec 9, 2013
    Posts:
    30
    Can anyone reproduce this?

    Create a new project, add UNet connectivity and at runtime instantiate and spawn 2 or more of the same prefab on the host.

    Have a script on the prefab that after a second sends a message to the clients from the host.

    One instance will receive the messages of all of them while the others get nothing. Use the editor log to display the name of the receiving instance and the sending instance by sending the netid of each object in the message.

    https://fogbugz.unity3d.com/default.asp?746665_i4c271jj4km359e7