Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tries to destroy null game object #2

Open
david-pfx opened this issue Apr 24, 2019 · 3 comments
Open

Tries to destroy null game object #2

david-pfx opened this issue Apr 24, 2019 · 3 comments

Comments

@david-pfx
Copy link

MissingReferenceException: The object of type 'GameObject' 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.GameObject.GetComponent[T] () (at C:/buildslave/unity/build/Runtime/Export/GameObject.bindings.cs:28)
Utilities+d__0.MoveNext () (at Assets/Scripts/Utilities.cs:22)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
d__41:MoveNext() (at Assets/Scripts/ShapesManager.cs:530)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

@dgkanatsios
Copy link
Owner

Does the error happen on this line?

https://github.com/dgkanatsios/MatchThreeGame/blob/master/Assets/Scripts/Utilities.cs#L22

Have you found out the root cause? Thanks for the report!

@david-pfx
Copy link
Author

I would think you have game objects that are initialised in the wrong order (version sensitivity). I can tell you that when I play the game there are no visible animations. I can't tell you what the root cause is, but probably nothing very complicated for someone who knows their way around the code.

@BigHandInSky
Copy link

After cloning the project, and updating to 2019.1 I'm also getting this error - adding

foreach (var item in potentialMatches)
{
    if(item == null) { continue; }
    ...
}

Is a working temporary fix - I encountered it after pressing the restart button in your demo scene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants