unable to respawn character after death in unity 2d

this error message shows up after player dies

NullReferenceException: Object reference not set to an instance of an object
GameManager.ResetGame () (at Assets/Scripts/GameManager.cs:166)
CharacterController2D+c__Iterator0.MoveNext () (at Assets/Scripts/CharacterController2D.cs:273)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

Hi @kb4eva

Your error NullReferenceException is very common, and not most likely related to 2D in any way…

You can find several discussions on this topic in general scripting forum. It means your object / instance is missing when you are trying to access it. Most likely it could be a GameObject that has been removed and the components went along it for example (and you still expect it to exist).