il2cpp-modder icon indicating copy to clipboard operation
il2cpp-modder copied to clipboard

Handling Arrays

Open Wakamu opened this issue 4 years ago • 2 comments

Is it possible to access a specific object inside an array when using the path memory way? Exemple:

public class MyHandler : MonoBehaviour
{
  public AnObject[] Objects;
}

public class AnObject : MonoBehaviour
{
  public string Name;
}

in this case, trying to access Objects[0].Name ?

Wakamu avatar May 17 '21 22:05 Wakamu

While definitely useful, this is not currently implemented. But maybe (and just maybe, I have not tested it out) to access the first element of Objects you could write the path as Objects.Name and it would work? Arrays are typically implemented as same sized contiguous blocks of memory, where the array pointer is just the array to the first element. So the address of the array + the offset for the name property, would point to the value you need. Again, this might not work, I'm not sure if the dump reader would recognize the array type properly.

If you'd like to implement it, I'd be happy to review you PR! I think the dump reader would be the place to add that code

juanmjacobs avatar May 24 '21 15:05 juanmjacobs

@juanmjacobs Any email to reach out to you on?

Octolus avatar Aug 30 '22 09:08 Octolus