Closed TheEmbracedOne closed 4 months ago
At the moment it can not. But it's already in plan #15
Edit:
Oh, unfortunately, changing a label of array/list itself requires an Editor level component, which requires you to enable SaintsEditor
. enabling SaintsEditor
WILL DISABLE meta attributes from NaughtyAttributes
Option one is (after this feature is added) to switch to SaintsEditor
Option two is to use SaintsArray
/SaintsList
which can work alone:
[RichLabel("<color=#f54e42><label/>"), SaintsArray]
public SaintsList<MapDestination> destinationsAccessibleFromHere;
private void Start() {
// can be used like a list
destinationsAccessibleFromHere.Add(default);
foreach(var v in destinationsAccessibleFromHere)
{
Debug.Log(v);
}
// obtain the actual list:
List<MapDestination> lis = destinationsAccessibleFromHere.value;
}
Edit 2:
Since you're also using NaughtyAttributes, the Label
from it should work as expected I guess (with Unity's standard rich text)?
Hi, since 2.3.9, it can be done with PlayaRichLabel
(but it requires SaintsEditor
)
There is some issue changing label for SaintsArray
, SaintsList
. Will be fixed on next release.
Hi, since 2.4.2, there are several ways to do it.
Option 1
Enable SaintsEditor
. This is the most "correct" way, but you'll no longer be able to use meta attributes from NaughtyAttributes
[PlayaRichLabel("<color=lame>It's Labeled!")]
public List<string> myList;
[PlayaRichLabel(nameof(MethodLabel), true)]
public string[] myArray;
// ReSharper disable once ParameterTypeCanBeEnumerable.Local
private string MethodLabel(string[] values)
{
return $"<color=green><label /> {string.Join("", values.Select(_ => "<icon=star.png />"))}";
}
Option 2
Using SaintsArray
/SaintsList
, this is a struct wrapped array/list. Not recommended.
[RichLabel("<color=cyan><label /><icon=star.png />"), SaintsArray]
public SaintsList<GameObject> saintsListGo;
Because of the limitations of Unity, there does not have some better ways I can think of.
I'll close this issue as it's been implemented. If you had any issue using these, please open a new issue. If you have other ideas, please either open a new issue or comment on this one (and I'll open it again)
First and foremost, thank you for this amazing tool! I'm currently using it along NaughtyAttributes. I'd like to colour the name of the list. As I understand that currently, this colours only the elements in a list:
Thank you