Skip to content

Commit c87b4eb

Browse files
committed
DebugLogItem.CopyLog function is registered via code rather than Button's Inspector
1 parent bc3d74a commit c87b4eb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Plugins/IngameDebugConsole/Scripts/DebugLogItem.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DebugLogItem : MonoBehaviour, IPointerClickHandler
3939
private TextMeshProUGUI logCountText;
4040

4141
[SerializeField]
42-
private RectTransform copyLogButton;
42+
private Button copyLogButton;
4343
#pragma warning restore 0649
4444

4545
// Debug entry to show with this log item
@@ -67,8 +67,9 @@ public void Initialize( DebugLogRecycledListView listView )
6767

6868
logTextOriginalPosition = logText.rectTransform.anchoredPosition;
6969
logTextOriginalSize = logText.rectTransform.sizeDelta;
70-
copyLogButtonHeight = copyLogButton.anchoredPosition.y + copyLogButton.sizeDelta.y + 2f; // 2f: space between text and button
70+
copyLogButtonHeight = ( copyLogButton.transform as RectTransform ).anchoredPosition.y + ( copyLogButton.transform as RectTransform ).sizeDelta.y + 2f; // 2f: space between text and button
7171

72+
copyLogButton.onClick.AddListener( CopyLog );
7273
#if !UNITY_EDITOR && UNITY_WEBGL
7374
copyLogButton.gameObject.AddComponent<DebugLogItemCopyWebGL>().Initialize( this );
7475
#endif
@@ -185,7 +186,7 @@ public void OnPointerClick( PointerEventData eventData )
185186
#endif
186187
}
187188

188-
public void CopyLog()
189+
private void CopyLog()
189190
{
190191
#if UNITY_EDITOR || !UNITY_WEBGL
191192
string log = GetCopyContent();

0 commit comments

Comments
 (0)