#[Bug] Hash128 inconsistent ToString and editor

1 messages · Page 1 of 1 (latest)

sonic loom
#

To reproduce:

using UnityEngine;
using Hash128 = 
Unity.Entities.Hash128;

public class TestHash128Display : MonoBehaviour {
    public Hash128 value;
    public string  toString;

    protected void OnValidate() {
        toString = value.ToString();
    }
}

12345678900000000000000000000000
becomes
21436587090000000000000000000000

I guess this is not supposed to be this way as it makes it difficult to debug in some cases (for instance some exception is thrown with a Hash128 value printed with ToString).

rustic summit
#

Just checked. This:

public class A: MonoBehaviour
{
    public Hash128 h = new Hash128(0x0000009078563412, 0);
    public string hString;

    private void Start()
    {
        hString = h.ToString();
    }
}
#

Become this:

sonic loom
#

I forgot to mention that it is about the Hash128 from Unity.Entities
(Editing the original message to include the import)

And as your test shows, the display is coherent with the toString using UnityEngine.Hash128

sonic loom
#

It seems that Unity.Entities.Hash128 is meant to have the same ToString as UnityEditor.GUID which is great (though saddly different from UnityEngine.Hash128) but then the inspector for Unity.Entities.Hash128 should also use the same representation.