MissingReferenceException problem

Hello, there is a problem with my game: after I play it and open main menu the following error is showing up many times. As much as I can understand, Idnet.cs is trying to access an object that is destroyed, so how can I fix this? May it be a problem with my code, or maybe it’s problem with Idnet.cs? I’ve tried to make Idnet.cs to check if he’s trying to access a null object, but I can’t make it work right.

MissingReferenceException: The object of type ‘GameUI’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.GetComponent[GameManager] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineComponentBindings.gen.cs:45)
GameUI.m__3 (KeyValuePair2 keyValuePair, System.Exception getException) (at Assets/AirStrike/Scripts/GameManager/GameUI.cs:177) Idnet+<CR_ProcessAsync>c__Iterator21[System.Collections.Generic.KeyValuePair`2[System.String,System.Int32]].MoveNext () (at Assets/Idnet/Idnet.cs:1878)

Hi semyonovyegor,
Looks like an issue in your script GameUI.cs that is using Idnet api at line 177.
Inside Idnet api,you may be calling some methods or variables from a script (attached on a gameobject) that doesnt exist anymore in the scene.

To test if anything going wrong in the api,just open IdnetSampleScene.unity scene,if thats working fine,then something getting wrong in your scripts,in this case you will have to probably check the the existence of a gameobject/component inside your scripts.

Example:
If(Gameobject.GetComponent(“GameUI”))
{
//This check will only work if GameUI reference exists.
}

I hope it helps.

Warm Regards,
Joll.

Y8 Games