I'm working on a Unity project that has integration to google firebase, namely the firestore. For iOS and android I'm using the sdk's from google which allows me to use some Firebase attributes on my fields to make reading and writing easier.
Attributes looks like, [FirestoreData] & [FirestoreProperty]
However, the SDK is not compatible with the webgl builds. I'd like to use the same classes for simplicity but the attributes mean it won't compile for webgl.
One solution, that I'm currently using, it just to duplicate the class sans attributes, e.g.
#if UNITY_WEBGL
public class SomeData
{
public float height { get; set; }
public float width { get; set; }
public float depth { get; set; }
}
#else
[FirestoreData]
public class SomeData
{
[FirestoreProperty] public float height { get; set; }
[FirestoreProperty] public float width { get; set; }
[FirestoreProperty] public float depth { get; set; }
}
#endif
but I wanted to know if there was a way to avoid this duplication. Can you tell c# to ignore certain attributes with the directives? e.g.
[FirestoreProperty && !UNITY_WEBGL] public float depth { get; set; }