Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[ServerRpc] Custom Attribute is stripped when compiled in a .dll

Discussion in 'Netcode for GameObjects' started by qNaN, Aug 18, 2022.

  1. qNaN

    qNaN

    Joined:
    Dec 29, 2015
    Posts:
    26
    I tried to move my player-class to a custom .dll (to be able to share code among projects), but I got this mysterious error, where it called my ServerRpc method on my Client as a regular method call instead of throwing a Remote Procedure Call to the server.
    I moved the class to Unity's /Asset directory instead, and it worked flawlessly.

    It seems that the method lost the [ServerRpc] tag and became a regular method.

    Is this a general problem with Custom Attributes run from .dlls, or am I doing something wrong when putting it in my .dll?