GameDriver uses the built-in Unity logging to capture useful information about the runtime of the test. The Unity Editor console can be a good place to troubleshoot issues such as object identification failures or errors, and additional information can be found in the Editor.log file which can be accessed by right-clicking the Console window in the Unity Editor and selecting "Open Editor Log".
For a standalone build, this file can be found under %TEMP%\<Company Name>\<Product Name> where Company Name and Product Name are defined in Unity under File > Build Settings > Player Settings under Player.
Added a tracing level to the logging which shows the commit hash for major components, which is useful for providing additional troubleshooting information, such as working with GameDriver Support. To enable trace logging, add the following line to GDIO/Resources/config/gdio.unity_agent.config.txt in your Unity project.
<logging><trace enabled="true" /></logging>
For example:
<?xml version="1.0" encoding="utf-8"?> <config version="0.2"> <objectresolvers> <resolver class="gdio.unity_agent.HierarchyPathObjectResolver" priority="0" /> </objectresolvers> <mouseclickhighlight radius="3" frames="15" style="circle" color="1.0,0.0,0.0"/> <ongui_events enabled="true" show_mouse="true"/> <hierarchypath primaryattribute="tag" /> <!-- x="10.0%" would place the X coordinate at 10% of the Screen.width in Unity --> <infobox enabled="true" x="10.0" y ="10.0" /> <!-- When doing WaitForObjectValue, if comparing strings and the string ends with a U+200B, the unicode point will be ignored in the comparison. Useful on TMP Input TextField --> <unicode><ignoreZeroWidthSpace enabled="true"/></unicode> <logging><trace enabled="true" /></logging> </config>
Once setting the trace level, you will need to close and reopen the Unity Editor for the change to take effect.
HierarchyPath Trace Logging
Enabling tracing for the HierarchyPathObjectResolver can assist in debugging any issues with HierarchyPath resolution. The following line can be added (or should replace any existing line with the hierarchypath header, if one is already present) in the same configuation file mentioned above:
<hierarchypath primaryattribute="tag" trace="true" logtoeditor="false" logtofile="true" logfilepath="C:\temp\myfile.txt"/>
For example:
<?xml version="1.0" encoding="utf-8"?> <config version="0.2"> <objectresolvers> <resolver class="gdio.unity_agent.HierarchyPathObjectResolver" priority="0" /> </objectresolvers> <mouseclickhighlight radius="3" frames="15" style="circle" color="1.0,0.0,0.0"/> <ongui_events enabled="true" show_mouse="true"/> <hierarchypath primaryattribute="tag" trace="true" logtoeditor="false" logtofile="true" logfilepath="C:\temp\myfile.txt"/> <!-- x="10.0%" would place the X coordinate at 10% of the Screen.width in Unity --> <infobox enabled="true" x="10.0" y ="10.0" /> <!-- When doing WaitForObjectValue, if comparing strings and the string ends with a U+200B, the unicode point will be ignored in the comparison. Useful on TMP Input TextField --> <unicode><ignoreZeroWidthSpace enabled="true"/></unicode> <logging><trace enabled="true" /></logging> </config>
Certain attributes can have their values changed as needed. Setting logtoeditor to true allows for the resulting info to also be output to the Unity editor log. Additionally, logfilepath can be changed to a different directory and/or filename of your choice, though be sure that the directory you are referencing already exists, otherwise the log file will not be produced.
Changes made to this configuration may not update until after the Unity Editor is closed and reopened, or until after the next time a test connects and disconnects from the GameDriver agent in your scene.