@@ -18,7 +18,7 @@ public class AppBarButton : MonoBehaviour
1818
1919 public int DisplayOrder { get { return displayOrder ; } }
2020
21- public bool Visible { get { return visible ; } }
21+ public bool Visible { get { return gameObject . activeSelf ; } }
2222
2323 [ SerializeField ]
2424 private PressableButton button = null ;
@@ -34,8 +34,6 @@ public class AppBarButton : MonoBehaviour
3434 private AppBar . ButtonTypeEnum buttonType = AppBar . ButtonTypeEnum . Custom ;
3535 [ SerializeField ]
3636 private int displayOrder ;
37- [ SerializeField ]
38- private bool visible ;
3937
4038 private AppBar parentToolBar ;
4139 private Vector3 targetPosition ;
@@ -81,26 +79,14 @@ public void InitializeButtonContent(AppBar parentToolBar)
8179 primaryLabels [ i ] . text = buttonText ;
8280
8381 seeItSayItLabel . text = "Say \" " + buttonText + "\" " ;
84-
85- // TODO use property blocks once Interactable no longer uses instanced materials
86- /*if (iconPropertyBlock == null)
87- iconPropertyBlock = new MaterialPropertyBlock();
88-
89- if (icon.HasPropertyBlock())
90- {
91- icon.GetPropertyBlock(iconPropertyBlock);
92- }
93- iconPropertyBlock.SetTexture("_MainTex", buttonIcon);
94- icon.SetPropertyBlock(iconPropertyBlock);*/
95-
9682 icon . material . mainTexture = buttonIcon ;
9783 break ;
9884 }
9985 }
10086
10187 private void UpdateButton ( )
10288 {
103- transform . localPosition = Vector3 . Lerp ( transform . localPosition , visible ? targetPosition : Vector3 . zero , Time . deltaTime * changeSpeed ) ;
89+ transform . localPosition = Vector3 . Lerp ( transform . localPosition , Visible ? targetPosition : Vector3 . zero , Time . deltaTime * changeSpeed ) ;
10490 }
10591
10692 public void SetTargetPosition ( Vector3 targetPosition )
@@ -110,11 +96,11 @@ public void SetTargetPosition(Vector3 targetPosition)
11096
11197 public void SetVisible ( bool visible )
11298 {
113- this . visible = visible ;
114-
99+ gameObject . SetActive ( visible ) ;
115100 // Use the interactable theme to make button invisible
116101 button . enabled = visible ;
117102 interactable . Enabled = visible ;
103+
118104 }
119105 }
120106}
0 commit comments