File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Runtime/AvatarCreator/Scripts/UI/Elements Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,22 @@ public abstract class SelectionElement : MonoBehaviour
19
19
[ SerializeField ] private SelectionButton buttonElementPrefab ;
20
20
[ SerializeField ] private GameObject selectedIconPrefab ;
21
21
[ SerializeField ] private Transform buttonContainer ;
22
- private GameObject selectedIcon ;
22
+
23
+ private GameObject _selectedIcon ;
24
+ private GameObject selectedIcon
25
+ {
26
+ get
27
+ {
28
+ if ( _selectedIcon )
29
+ {
30
+ return _selectedIcon ;
31
+ }
32
+ _selectedIcon = Instantiate ( selectedIconPrefab , buttonContainer ) ;
33
+ selectedIcon . SetActive ( false ) ;
34
+ return _selectedIcon ;
35
+ }
36
+ }
37
+
23
38
24
39
[ Space ( 5 ) ]
25
40
[ Header ( "Events" ) ]
@@ -28,12 +43,6 @@ public abstract class SelectionElement : MonoBehaviour
28
43
29
44
protected Transform ButtonContainer => buttonContainer ;
30
45
31
- private void Start ( )
32
- {
33
- selectedIcon = Instantiate ( selectedIconPrefab , buttonContainer ) ;
34
- selectedIcon . SetActive ( false ) ;
35
- }
36
-
37
46
/// <summary>
38
47
/// Creates button elements for each asset in the provided array.
39
48
/// This function is generic and can work with any asset type that implements the IAssetData interface.
You can’t perform that action at this time.
0 commit comments