Open novavision opened 7 months ago
Unfortunately this project hasn't merge PR for years... Here is one that might fit your need (though not exactly what you want) (It's very new so might be buggy)
to demo:
public class RootClass : MonoBehaviour
{
public string root1;
public string root2;
[Layout("RootGroup", ELayout.Title | ELayout.Background | ELayout.TitleOut)]
public int firstInt;
[Layout("RootGroup")]
public int secondInt;
public string rootAfterGroup;
}
public class Sub1 : RootClass
{
[Layout("RootGroup")] public int sub1ToRoot;
public string sub1Item1;
[Layout("Sub1Group", ELayout.Title | ELayout.Background)] public int sub1Group1, sub1Group2;
public string sub1ItemAfterGroup;
}
public class Sub2: RootClass
{
[Layout("RootGroup")] public int sub2ToRoot;
public string sub2Item1;
[Layout("Sub2Group", ELayout.Title | ELayout.Background)] public int sub2Group1, sub2Group2;
public string sub2ItemAfterGroup;
}
Result:
So the field stay at the position by the order of declaration and inheriting, but also gets pumped to the first group when necessary.
As for "to see very specific BoxGroup on top of all others", the Ordered
attribute might help
@TylerTemp looks cool, thanks. Did I correctly understand that your asset expand same base functionality NaughtyAttributes has? In other words I don't need to do some migration renaming attributes?
@TylerTemp looks cool, thanks. Did I correctly understand that your asset expand same base functionality NaughtyAttributes has? In other words I don't need to do some migration renaming attributes?
Unfortunately, the renderer behavior (demonstrated here, the Layout
), is the Editor
level function. I quote from NA's documents:
The attributes that won't work in your custom editors are the meta attributes and some drawer attributes such as ReorderableList, Button, ShowNonSerializedField and ShowNativeProperty.
the meta attributes, or the Editor
level functions I mentioned here, is NOT compatible with each other: Odin
, NaughtyAttributes
, MarkupAttributes
, SaintsField.SaintsEditor
-- only one can work at a time.
In short, there are only 3 options possible:
SaintsField
, or Odin
(as it provide the Order
function which suits your needs). But you need to learn and switch all the stuff...C#
, you may need to do more work to achieve what you wantUsing the mix of SaintsField
and NaughtyAttributes
, but make SaintsField.SaintsEditor
as your main Editor
class. There are one advantage and two disadvantages of this:
Good news: any attributes in NaughtyAttributes
which are NOT meta attributes, you can use it as expected. Nothing need to be changed.
Bad news: You need to manually change these meta attributes:
Button -> SaintsField.Playa.Button
ShowNonSerializedField -> SaintsField.Playa.ShowInInspector
ShowNativeProperty -> SaintsField.Playa.ShowInInspector
ReorderableList -> nothing. Unity default uses ReorderableList
now
BoxGroup -> SaintsField.Playa.Layout
Foldout -> SaintsField.Playa.Layout
EnableIf / DisableIf -> SaintsField.ReadOnly
ShowIf / HideIf -> SaintsField.ShowIf
/SaintsField.HideIf
Label -> SaintsField.RichLabel
OnValueChanged -> SaintsField.OnValueChanged
ReadOnly -> SainsField.ReadOnly
MinValue / MaxValue -> SaintsField.MinValue
/SaintsField.MaxValue
Required -> SaintsField.Required
ValidateInput -> SaintsField.ValidateInput
Some APIs are the same as NaughtyAttributes, but some are not...
Bad news: the compatible is not well tested. Nuh, in fact, the whole project is not well tested. I use it in my personal project, and my company's project. But it's far not well tested compared to NaughtyAttributes
First of all thanks a lot for your asset, it is just a gem! Made my project looks much more organized.
Working with NestedAttributes for a pretty long time I experienced that I miss order option for some attributes . For example BoxGroup - I have about 4 inheritors and each of them have some specific serialized fields I place under the BoxGroup. In some cases I wish to see very specific BoxGroup on top of all others just for better accessibility and prettier visuals. That's also because some classes have too many fields and may take the area of entire screen height. Foldout BoxGroup may be very handy here as well, but that's a different story.
I there an option to add some order parameter to BoxGroup attribute?