Help! Access GameObjects Unity

Kaorin333

Solid & Active Platinian
Hello, i would like to know how i can access the GameObject of all items in the game.
Every gameobject in the game like items or weapons which are laying around must be one, right.
So how would i access these objects.

Find them via FindGameObjectWithTag sure, but whats the tag.

Im a bit lost in how i can access them, for me it doesnt matter was it is, i just wanna access them.
Btw i was already trying it ofc, but when i did it the sturct of "UnityEngine_GameObject_Fields" are empty but like you can see in the screenshot they shouldnt (tag, isActive, isStatic...)

Thank you for reading and i hope someone can enlight me here again.

1656929480084.png
 
Im not sure how you would find the tag. Have you tried looking for a field that handles the position of the items?
Okay lets talk about this first, what i do for finding the tags is simply hooking the function in GameObject and reading the tags everytime its getting called, not good ? maybe. but first of all this is what i do.
But here is also another problem i found,

C++:
void(*old_GameObject)(void* instance, monoString* name);
void GameObject(void* instance, monoString* name) {
    if (instance != NULL) {
        LOGI("GameObject: %s", FromUTF16(name).c_str());
    }

    old_GameObject(instance, name);
}

as result i get the tag BUT i also get a error from the original method

Code:
07-05 12:18:08.712 20257 20311 E Unity   : ArgumentException: Tag: tag name is null or empty.

it seems that the string translation with monoString isnt working for the UnityEngine.CoreModule, do you know how to fix it or what is the reason?
 
Okay lets talk about this first, what i do for finding the tags is simply hooking the function in GameObject and reading the tags everytime its getting called, not good ? maybe. but first of all this is what i do.
But here is also another problem i found,

C++:
void(*old_GameObject)(void* instance, monoString* name);
void GameObject(void* instance, monoString* name) {
    if (instance != NULL) {
        LOGI("GameObject: %s", FromUTF16(name).c_str());
    }

    old_GameObject(instance, name);
}

as result i get the tag BUT i also get a error from the original method

Code:
07-05 12:18:08.712 20257 20311 E Unity   : ArgumentException: Tag: tag name is null or empty.

it seems that the string translation with monoString isnt working for the UnityEngine.CoreModule, do you know how to fix it or what is the reason?
I did a bit of looking, and if objects arent assigned a tag in the unity engine by the developers then it doesnt have one. So your code possibly could be right, its just that the objects you looked at have no tags

keep im mind im not really to sure since I have never really needed to use tags
 
Thank you for looking into it, but i guess that these gameobjects have tags, like i said

if (instance != NULL) {
LOGI("GameObject: %s", FromUTF16(name).c_str());
}

is giving me the tag. for example "WorldUsers".

but as soon, this is called:

old_GameObject(instance, name);

the error message is coming:

07-05 12:18:08.712 20257 20311 E Unity : ArgumentException: Tag: tag name is null or empty.

so it must be the string translation for it. But it works with other functions from other methods inside of the AssemblyCharp.
The problem is then that the gameobjects cannot be loaded cause the hook is giving the wrong inputs to the original function.
But also this was just a offtopic here. Maybe i need to figure it out by myself.

I would just like to get an example code of how to loop through the gameobjects. Even if we would like to skip the part with the tag for the gameobjects.

Thank you
 
Back
Top Bottom