Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 9f78c50

Browse files
committed
Use "untitled" for transforms with empty names
1 parent bc64a04 commit 9f78c50

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/UI/Widgets/TransformTree/TransformCell.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public class TransformCell : ICell
1616
{
1717
public float DefaultHeight => 25f;
1818

19-
public bool Enabled => m_enabled;
20-
private bool m_enabled;
19+
public bool Enabled => enabled;
20+
private bool enabled;
2121

2222
public Action<CachedTransform> OnExpandToggled;
2323
public Action<CachedTransform> OnEnableToggled;
2424
public Action<GameObject> OnGameObjectClicked;
2525

2626
public CachedTransform cachedTransform;
27-
public int _cellIndex;
27+
public int cellIndex;
2828

2929
public GameObject UIRoot { get; set; }
3030
public RectTransform Rect { get; set; }
@@ -37,13 +37,13 @@ public class TransformCell : ICell
3737

3838
public void Enable()
3939
{
40-
m_enabled = true;
40+
enabled = true;
4141
UIRoot.SetActive(true);
4242
}
4343

4444
public void Disable()
4545
{
46-
m_enabled = false;
46+
enabled = false;
4747
UIRoot.SetActive(false);
4848
}
4949

@@ -58,14 +58,17 @@ public void ConfigureCell(CachedTransform cached, int cellIndex)
5858
if (!Enabled)
5959
Enable();
6060

61-
_cellIndex = cellIndex;
61+
this.cellIndex = cellIndex;
6262
cachedTransform = cached;
6363

6464
spacer.minWidth = cached.Depth * 15;
6565

6666
if (cached.Value)
6767
{
68-
NameButton.ButtonText.text = cached.Value.name;
68+
string name = cached.Value.name?.Trim();
69+
if (string.IsNullOrEmpty(name))
70+
name = "<i><color=grey>untitled</color></i>";
71+
NameButton.ButtonText.text = name;
6972
NameButton.ButtonText.color = cached.Value.gameObject.activeSelf ? Color.white : Color.grey;
7073

7174
EnabledToggle.Set(cached.Value.gameObject.activeSelf, false);

0 commit comments

Comments
 (0)