Search Unity

How to identify new player receiving RaiseEvent

Discussion in 'Multiplayer' started by Chen5464, Nov 24, 2022.

  1. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    Im trying to kinda create RPC function but in RaiseEvent. the only problem i seem to see that i cant send this to new players? (like allbufferdviaserver in RPC).
    anything Im missing? is there a way to send it to new players that joining?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
  3. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    ok thanks for replay, Im trying to send enums through the net, i cant use OnPhotonSerializeView with it, nor RPC seem to work(gives me null ref whenim trying to send and use int as param) so im gonna try Raise Event
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    The problem is not which method you use to send them. The problem is that our serializer doesn't know your enum.
    Cast to byte / int and send that. Then cast back to your enum. This is the easiest way.
    Alternatively, register the enum type as custom type and implement the methods to de/serialize it. CustomTypes.cs does this, for example.

    Then you can use it in any of the methods you named...