UnityResolve.hpp icon indicating copy to clipboard operation
UnityResolve.hpp copied to clipboard

how to fill an array with data?

Open Zodys opened this issue 1 year ago • 3 comments

const auto assembly = UnityResolve::Get("assembly.dll | 程序集名称.dll"); const auto pClass = assembly->Get("className | 类名称"); const auto array = UnityResolve::UnityType::Array<T>::New(pClass, size); std::vector<T> cppVector = array.ToVector();

how to fill an array with int, float, string, object, etc. values?

Zodys avatar May 04 '24 14:05 Zodys

use array->Fill(value) *array[index] = value

issuimo avatar May 06 '24 04:05 issuimo

this will work if I need to create an array like this? Player player; object[] example = new object[] { "Hello", 123, true, player };

Zodys avatar May 06 '24 05:05 Zodys

https://github.com/DeNcHiK3713/AndroidMixMod/blob/2c1bcbd4ccfd1c7b43186841a79a020b1e9f66e2/app/src/main/jni/Main.cpp#L313

to add such data, need to use il2cpp_value_box. Can you add this to your code please?

Zodys avatar May 06 '24 06:05 Zodys