Find with substring
std::string m_sObjectSubstring = "VRCPlayer[Local]";
// Obtain list
Unity::il2cppArray<Unity::CGameObject*>* m_pObjects = Unity::Object::FindObjectsOfType<Unity::CGameObject>(UNITY_GAMEOBJECT_CLASS);
// Looping through list
for (uintptr_t u = 0U; m_pObjects->m_uMaxLength > u; ++u)
{
Unity::CGameObject* m_pObject = m_pObjects->m_pValues[u];
if (!m_pObject) continue; // Just in-case
// Obtaining object name and then converting it to std::string
std::string m_sObjectName = m_pObject->GetName()->ToString();
if (m_sObjectName.find(m_sObjectSubstring) != std::string::npos)
{
// Your code after it finds desired object.
break;
}
}
Last updated