Browse Source

Move Character Portrait nulls to end of list

master
shalliwell 5 years ago
parent
commit
3681fb094d
  1. 5
      Assets/Fungus/Scripts/Components/Character.cs
  2. 4
      Assets/Fungus/Scripts/Utils/PortraitUtils.cs

5
Assets/Fungus/Scripts/Components/Character.cs

@ -184,7 +184,10 @@ namespace Fungus
protected virtual void OnValidate()
{
portraits.Sort(PortraitUtil.PortraitCompareTo);
if (portraits != null && portraits.Count > 1)
{
portraits.Sort(PortraitUtil.PortraitCompareTo);
}
}
}
}

4
Assets/Fungus/Scripts/Utils/PortraitUtils.cs

@ -189,9 +189,9 @@ namespace Fungus
if (x == y)
return 0;
if (y == null)
return 1;
if (x == null)
return -1;
if (x == null)
return 1;
return x.name.CompareTo(y.name);
}

Loading…
Cancel
Save