Search Unity

[Serializable] attribute in WP8 plugins

Discussion in 'Windows' started by npruehs, Oct 14, 2014.

  1. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey everybody,

    we're using a fairly big collection of plugins for re-using code between our Unity games. Some of the classes of these plugins have the [Serializable] attribute attached.

    We've got two questions about this, trying to port FreudBot to Windows Phone now:

    1. As Aurimas mentioned, you can wrap those attributes with #if UNITY_METRO if you don't use it for serialization. However, doing so causes building the player to fail. We've created a minimum repro and filed a bug report here: http://fogbugz.unity3d.com/default.asp?639805_3ka6s3q97vd0hrbj

    2. What can we do if we actually DO use these attributes for having Unity serialize instances of these classes, which might be the more common case, by far, after all?

    Thanks,
    Nick
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Hi,

    do you have the source code for the plugins you use? If you do, you can solve this by referencing WinRTLegacy.dll when building the plugins - it's located in <UNITY_INSTALLATION_DIR>\Editor\Data\PlaybackEngines\wp8support\Managed folder. We implemented a lot of missing types in .NET for WP8 in that dll, System.SerializableAttribute is one of them (that's why you're able to use it in your scripts).
     
    Last edited: Oct 14, 2014
  3. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Thanks Tautvydas, works like a charm!