Search Unity

(SOLVED)Any performance issues on HLAPI attributes?

Discussion in 'Multiplayer' started by Deleted User, Jul 1, 2017.

  1. Deleted User

    Deleted User

    Guest

    Good afternoon.
    Devs, Is there any performance problems with functions marked as [Client], [Server], [ClientCallback] etc?
    As I know it's reflection stuff which is slow, or not?

    Thanks.

    SOLVED: Seems like attributes just tell compiler to add condition so it will be added to your standalone build.

    That's how code looks after decompilation.

    if(!NetworkClient.active) for client callback



    And if(!NetworkServer.active) for server callback.

     
    Last edited by a moderator: Jul 1, 2017
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yes, mostly those attributes used for the UnetWeaver to properly add some logic during code generation. So there's low impact on the performance during runtime. Though, checks are still checks. Don't use them where they're not needed.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    a bit off-topic, is there any ways to override NetworkWriter writing method, I want to implement protobuf serialization of messages.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Deleted User likes this.