I am creating a pointer and storing this in a native hash map, but how do I convert this back to my struct when getting the value back?
I create it like this:
T* p = &myStruct;
hashMap.Add(myStruct, (int)p); //<MyStruct,int>
Now reading it back I am trying to do:
if(hashMap.TryGetValue(item, out int ptr)){
T myStruct = *ptr; // don't know the right syntax here
Debug.Log(myStruct.Equals(item)); // should be the same
}
I cannot use IntPtr because I cannot use Marshal.PtrToStructure. Unity's compiler does not allow it within its threads.
