Add support to the dump command to print UnityEngine.GUID and UnityEngine.Hash128(https://docs.unity3d.com/ScriptReference/Hash128.html) as a single hex string.
The current output is very hard to work with, because for GUIDs it prints each 32 bit value individual, e.g. it shows the raw details of how that compound type is serialized.
sourceAssetGUID (GUID)
data[0] (unsigned int) 3418958961
data[1] (unsigned int) 1234290355
data[2] (unsigned int) 2387373188
data[3] (unsigned int) 291235581
What we want is something like the yaml output:
sourceAssetGUID: f778ae0076321f44ab2c21fcaac7036e
binary2text.exe already supports this case:
m_SceneGUID f778ae0076321f44ab2c21fcaac7036e(GUID)
Similarly our output for Hash128 is not convenient:
m_ObjectIdHash (Hash128)
bytes[0] (UInt8) 46
bytes[1] (UInt8) 223
bytes[2] (UInt8) 41
bytes[3] (UInt8) 248
bytes[4] (UInt8) 6
bytes[5] (UInt8) 52
bytes[6] (UInt8) 93
bytes[7] (UInt8) 188
bytes[8] (UInt8) 135
bytes[9] (UInt8) 98
bytes[10] (UInt8) 70
bytes[11] (UInt8) 244
bytes[12] (UInt8) 198
bytes[13] (UInt8) 119
bytes[14] (UInt8) 247
bytes[15] (UInt8) 91
Note: For Hash128 binary2text is also currently not printing out the Hash128 as a hex string. It seems that is just a missing case in that tool, not a fundamental problem for this simple data structure.
Implementation tip:
UnityDataTool already has helpers for dealing with these types when importing into the analyze database (see GuidHelper.FormatUnityGuid, FormatUnityHash128).
This task is to recognize these particular compound types when going through the serialized binary data in TextDumperTools.cs, and to print out the friendly form instead of the internal representation. We already do this for strings (which are actually represented as arrays of chars).
We may add further compound types in future (there are several other types listed here https://docs.unity3d.com/ScriptReference/SerializedPropertyType.html) The code for detecting these types and performing a dedicated handling should be clean - not over engineered, but also not hardcoded directly into the main code flow, so that adding more types in the future will be just a question of following an established pattern.
Add support to the dump command to print UnityEngine.GUID and UnityEngine.Hash128(https://docs.unity3d.com/ScriptReference/Hash128.html) as a single hex string.
The current output is very hard to work with, because for GUIDs it prints each 32 bit value individual, e.g. it shows the raw details of how that compound type is serialized.
What we want is something like the yaml output:
binary2text.exe already supports this case:
Similarly our output for Hash128 is not convenient:
Note: For Hash128 binary2text is also currently not printing out the Hash128 as a hex string. It seems that is just a missing case in that tool, not a fundamental problem for this simple data structure.
Implementation tip:
UnityDataTool already has helpers for dealing with these types when importing into the analyze database (see GuidHelper.FormatUnityGuid, FormatUnityHash128).
This task is to recognize these particular compound types when going through the serialized binary data in TextDumperTools.cs, and to print out the friendly form instead of the internal representation. We already do this for strings (which are actually represented as arrays of chars).
We may add further compound types in future (there are several other types listed here https://docs.unity3d.com/ScriptReference/SerializedPropertyType.html) The code for detecting these types and performing a dedicated handling should be clean - not over engineered, but also not hardcoded directly into the main code flow, so that adding more types in the future will be just a question of following an established pattern.