Unity Importer type constraints in abstract classes

Mon 31. Jul 2017, 21:51

Currently, it doesn't seem to be supported to use the ArticyTypeConstraint attribute on private serialized fields, which are declared in an abstract MonoBehaviour, but I'd very much like to use the feature in this way.

Code: Select all
public class MyChildClass : MyBaseClass
{
   // This works correctly in the inspector.
   [Articy.Unity.ArticyTypeConstraint(typeof(Articy.MyProject.TextObject))]
   [SerializeField]
   private ArticyRef myReferenceInChild;
}

public abstract class MyBaseClass : MonoBehaviour
{
   // This shows in the inspector, but doesn't constrain to the given type,
   // instead it shows all ArticObjects.
   [Articy.Unity.ArticyTypeConstraint(typeof(Articy.MyProject.TextObject))]
   [SerializeField]
   private ArticyRef myReferenceInBase;
}


I'd be happy, if this was possible. Thank you! :)

PS: Of course I can just make my fields protected as a workaround, but I thought it's probably feasible to also reflect over the base type when getting the SerializedObject's fields in the Articy PropertyDrawer.
Xarbrough
 
Posts: 2
Joined: Mon 31. Jul 2017, 21:44

Re: Unity Importer type constraints in abstract classes

Tue 1. Aug 2017, 12:03

Hi Xarbrough,

interesting find! This happened because of an odd decision in the .NET framework regarding reflection when it comes to private members in base classes.
Anyway, i fixed it and in the next version of the plugin it should work as expected!

Thanks for reporting it!

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Unity Importer type constraints in abstract classes

Wed 2. Aug 2017, 20:36

Awesome!
Xarbrough
 
Posts: 2
Joined: Mon 31. Jul 2017, 21:44

Re: Unity Importer type constraints in abstract classes

Tue 15. Aug 2017, 15:26

Hi Xarbrough,

the new release should fix that issue.

Thank you again for reporting it!

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 16 guests

Who We Are
Contact Us
Social Links