Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

How to identify new player receiving RaiseEvent

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

  1. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    14
    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:
    2,945
  3. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    14
    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:
    2,945
    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...