Skip to content

Commit fa6e626

Browse files
committed
HelloUSD to be a bit more user-friendly
1 parent bb60d3e commit fa6e626

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

package/com.unity.formats.usd/Samples/HelloUsd/HelloUsdExample.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using UnityEditor;
1516
using UnityEngine;
1617
using USD.NET;
1718

@@ -29,8 +30,14 @@ class MyCustomData : SampleBase
2930

3031
void Start()
3132
{
33+
#if UNITY_EDITOR
34+
FocusConsoleWindow();
35+
#endif
36+
3237
InitUsd.Initialize();
38+
Debug.Log("=-=-=-=-=-= Starting HelloUsd Test Example =-=-=-=-=-=");
3339
Test();
40+
Debug.Log("=-=-=-=-=-= HelloUsd Test Example Finished =-=-=-=-=-=");
3441
}
3542

3643
void Test()
@@ -67,5 +74,25 @@ void Test()
6774

6875
scene.Close();
6976
}
77+
78+
private static EditorWindow GetConsoleWindow()
79+
{
80+
var editorWindowTypes = TypeCache.GetTypesDerivedFrom<EditorWindow>();
81+
foreach (var type in editorWindowTypes)
82+
{
83+
if (type.Name == "ConsoleWindow")
84+
{
85+
return EditorWindow.GetWindow(type);
86+
}
87+
}
88+
89+
throw new System.Exception("Error could not find ConsoleWindow type");
90+
}
91+
92+
public static void FocusConsoleWindow()
93+
{
94+
var consoleWindow = GetConsoleWindow();
95+
consoleWindow.Focus();
96+
}
7097
}
7198
}

0 commit comments

Comments
 (0)