diff --git a/src/core/scripting/python/python_script_context.h b/src/core/scripting/python/python_script_context.h index 207bf182..6ce1a43d 100644 --- a/src/core/scripting/python/python_script_context.h +++ b/src/core/scripting/python/python_script_context.h @@ -49,9 +49,13 @@ class PythonScriptContext : public ScriptContext { } void PhysicsProcess(Entity entity, double deltaTime) override { - if (PyObject_HasAttr(pythonCache->GetClassInstance(entity), physicsProcessFunctionName)) { - CPyObject processCallValue = PyObject_CallMethod(pythonCache->GetClassInstance(entity), "_physics_process", "(f)", deltaTime); + PyGILState_STATE pyGilStateState = PyGILState_Ensure(); + { + if (PyObject_HasAttr(pythonCache->GetClassInstance(entity), physicsProcessFunctionName)) { + CPyObject processCallValue = PyObject_CallMethod(pythonCache->GetClassInstance(entity), "_physics_process", "(f)", deltaTime); + } } + PyGILState_Release(pyGilStateState); PyErr_Print(); }