5.4 C++ Spawn schematyc entity in c++
Posted: Mon Aug 21, 2017 11:25 am
Hi! Do you know any way to spawn schematyc entity in c++? I know how to spawn entities and I know how to create components and assign it to the entities, but I am asking about schematyc-made entity (you know.. the entity that is in legacy entities and was made clearly in schematyc) .
I tried to find a class of it
But no matter what it always returns null.
I don't know how to find class of that entity. Well.. I know schematyc uses BasicEntity and all we do is just assigning components to it, but in the end I want to spawn this setup I made. Any ideas?
Edit:
Found the solution. For anyone who is trying to spawn schematyc entity there is what I did:
1.I found all entities that my engine has like that:
This will show even schematyc entities. It will log them into console. So thanks to that loop, I found how to access schematyc entities.
I think it is not case sensitive.
In my case it was :
I tried to find a class of it
Code: Select all
IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("rifle1")l
I don't know how to find class of that entity. Well.. I know schematyc uses BasicEntity and all we do is just assigning components to it, but in the end I want to spawn this setup I made. Any ideas?
Edit:
Found the solution. For anyone who is trying to spawn schematyc entity there is what I did:
1.I found all entities that my engine has like that:
Code: Select all
IEntityClassRegistry *pClassReg = gEnv->pEntitySystem->GetClassRegistry();
IEntityClass *pClass = nullptr;
pClassReg->IteratorMoveFirst();
for (int i = 0; i < pClassReg->GetClassCount(); i++)
{
if (pClass = pClassReg->IteratorNext())
{
CryLogAlways("CLASS NAME = %s", pClass->GetName());
}
}
Code: Select all
IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("schematyc::yourfolder::anotherfolder::entityName);
In my case it was :
Code: Select all
IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("schematyc::items::weapons::rifle1);