Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to fill an array with data? #13

Open
Zodys opened this issue May 4, 2024 · 3 comments
Open

how to fill an array with data? #13

Zodys opened this issue May 4, 2024 · 3 comments

Comments

@Zodys
Copy link

Zodys commented May 4, 2024

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

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

@issuimo
Copy link
Owner

issuimo commented May 6, 2024

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

@Zodys
Copy link
Author

Zodys commented May 6, 2024

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

@Zodys
Copy link
Author

Zodys commented May 6, 2024

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 Zodys closed this as completed May 6, 2024
@Zodys Zodys reopened this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants