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. Dismiss Notice

Generic Network Behaviours

Discussion in 'Multiplayer' started by irwiss, Sep 13, 2015.

  1. irwiss

    irwiss

    Joined:
    Apr 14, 2015
    Posts:
    7
    Hello,

    I'm trying to use generics with NetworkBehaviours, compiling it gives no errors but I'm getting Invalid IL code exception at runtime

    I've attached a project which has a simple reproduction, start from init scene and press host.
    Behaviours are empty and hierarchy goes like:

    ConcreteGenericNetBehaviour:AbstractGenericNetBehaviour<int>:NetworkBehaviour

    The exception that's raised should look like

    I'm guessing generics aren't supported, will they be or is it out of scope?
    Or if they are, what am I doing wrong?
    Is generating invalid IL in this case by-design or is it a bug?
     

    Attached Files:

  2. TehGM

    TehGM

    Joined:
    Nov 15, 2013
    Posts:
    89
    Confirmed, I'm getting that exception too when trying your example.
     
  3. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    This is not supported. There are no plans for adding support for this.

    bug 727522 filed on this causing a UNetWeaver exception