Ok so, im having a little issue and i know that unity is not thread safe, but i dont see why this wont work. i am using this function :
public void destroyEntityInWorld(Entity entity)
{
Debug.Log("Destroying "+entity.entityName + " with ID value " + entity.entityID);
GameObject reference = entities[entity.entityID];
entities[entity.entityID] = null;
gameManager.gameEngine.destroyGameObject(entity.entityName+"_"+entity.entityID);
}
and i am getting a threading issue :
Find can only be called from the main thread.
Does this mean that the other thread is trying to call the function on the other script? also is there a way to actually destroy a gameobject without mono? can i send a message to a function which is on the main thread to destroy it?
Also, the function i am calling is :
public void destroyGameObject(string name)
{
Destroy(GameObject.Find(name));
}
Thanks.