Skip to content

Commit 67e63a3

Browse files
author
Robert El-Soudani
committed
Making SimpleSinglePointerSelector warnings and errors easier to diagnose
By providing the "this" reference as the context object to Unity's Debug methods, when a message comes up in the Unity Editor console window and the user clicks on it, the given game object will be highlighted in the Hierarchy, making it easier to figure out which component is reporting the issue.
1 parent 1c8e1fc commit 67e63a3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Assets/HoloToolkit/Input/Scripts/Focus/SimpleSinglePointerSelector.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private void Start()
5555
FindCursorIfNeeded();
5656
ConnectBestAvailablePointer();
5757

58-
Debug.Assert(currentPointer != null);
58+
Debug.Assert(currentPointer != null, this);
5959
}
6060

6161
private void OnEnable()
@@ -134,6 +134,7 @@ private void FindCursorIfNeeded()
134134
if ((Cursor == null) && SearchForCursorIfUnset)
135135
{
136136
Debug.LogWarningFormat(
137+
this,
137138
"Cursor hasn't been explicitly set on \"{0}.{1}\". We'll search for a cursor in the hierarchy, but"
138139
+ " that comes with a performance cost, so it would be best if you explicitly set the cursor.",
139140
name,
@@ -144,11 +145,12 @@ private void FindCursorIfNeeded()
144145

145146
if ((foundCursors == null) || (foundCursors.Length == 0))
146147
{
147-
Debug.LogErrorFormat("Couldn't find cursor for \"{0}.{1}\".", name, GetType().Name);
148+
Debug.LogErrorFormat(this, "Couldn't find cursor for \"{0}.{1}\".", name, GetType().Name);
148149
}
149150
else if (foundCursors.Length > 1)
150151
{
151152
Debug.LogErrorFormat(
153+
this,
152154
"Found more than one ({0}) cursors for \"{1}.{2}\", so couldn't automatically set one.",
153155
foundCursors.Length,
154156
name,

0 commit comments

Comments
 (0)