I am calling function from secondary thread without any problem until I saw this on console:
ERROR: Sending events is only supported from the main thread
this is function called from second thread
void Player_LightOnOff(bool OnTrue)
{
if (Urho3D::Player::Player_Instance != nullptr)
{
Urho3D::Player::Player_Instance->LightOnOff(OnTrue);
}
}
void Urho3D::Player::LightOnOff(bool OnTrue)
{
if (OnTrue)
{
m_light->SetEnabled(true);
}
else
{
m_light->SetEnabled(false);
}
}
code is working I have no crashes, but should I call it really from main thread?