Hi Guys,
I'm getting this "Destroying GameObjects immediately is not permitted during physics trigger/contact or animation event callbacks...." error and haven't been able to solve it, apprently it is to do with destroying drawcalls rather than actual physics stuff...the error happens when I'm running in the editor and results in "burnt in" widgets on screen.
Player log:
! about ot do destroy immediate on : _UIDrawCall [joyMaterial]
! (error) Destroying GameObjects immediately is not permitted during physics trigger/contact or animation event callbacks. You must use Destroy instead.
What I'm doing is disabling a panel with widgests and stuff...
Here is my code:
void OnDisable()
{
//Do stuff with the Panels
foreach (GameObject _gameObject in GUIPanelGameObjects)
{
if (_gameObject!=null)
{
//Instead of setActiverrecusively
NGUITools.SetActive(_gameObject, false);
Debug.Log("Disabling panel: " + _gameObject.name);
}
}
}
What I have is a ScreenObject that represents a screen and it's required Panel(s) ( InGameWidgetsPanel,PausePanel...etc).
I use these "ScreenObjects" to control what I see on Screen by disabling/Enabling them and through that also disabling/hiding referenced ngui panels and their widgets.
Would anybody have any advice on how to solve this..?
ThanksInAdvance!
Stefan