Closed laurentopia closed 4 months ago
Hi, thanks for reporting.
Though it's a good advice, it'll have too many problems to keep API level compatible with NaughtyAttributes.
Here is a piece of document of migrate from NaughtyAttributes. (Well, this will be merged to the document when I have spare time)
NA needs Editor component to render meta attributes (Like Button
, GroupBox
, ShowIf
). It's applied by default. Once it's installed, it can not be removed unless changing the source code.
SaintsField also needs Editor component to render SaintsEditor
attributes. You need to go Window
- Saints
- Apply SaintsEditor
to enable it. This ensure that SaintsField won't break your project when you only want to use "pure attributes"
The namespace is SaintsField.Playa
, to difference between "pure attributes" with "editor attributes"
It's under namespace SaintsField.Playa
using SaintsField.Playa; // add this line please
[Button]
private void MethodOne() { }
[Button("Button Text")]
private void MethodTwo() { }
To enable/disable in different mode:
// naughtyattributes uses EButtonEnableMode
[Button("Button Text", EButtonEnableMode.Editor)]
private void MethodTwo() { }
// SaintsEditor uses PlayaEnableIf/PlayaDisableIf
[Button("Button Text"), PlayaEnableIf(EMode.Edit)]
private void MethodTwo() { }
Difference: NaughtyAttributes allow IEnumerable
, which is not supported by SaintsEditor
.
In NaughtyAttributes we have ShowNativeProperty
(for non-serializable property) and ShowNonSerializedField
(for non-serializable fields).
In SaintsEditor
it's ShowInInspector
, because I really don't care it's a property or a field.
using SaintsField.Playa; // add this line please
[ShowInInspector]
public static Color MyStaticProp => Color.green; // native Property
[ShowInInspector]
public static Color StaticField = Color.blue; // non serialized Property
[ShowInInspector]
public static readonly string StaticReadOnlyField = "Building Nothing Out of Something"; // non serialized Field
[ShowInInspector]
public const float MyConst = 3.14f; // non serialized Field
Will be updated to document someday (like, Label
is RichLabel
)
(P.S. SaintsField is not a folk of NaughtyAttributes, it's something that I need which is either not in NA, or hard to customize in NA :smile: )
Oh I didn't know there was a 1:1 equivalent. I wonder where I was looking :/
SaintsField being a fork of Naughty it is better if it keeps the same attributes and add new ones.