Wednesday 14 February 2018

NullReferenceException with unity3d on iOS

To debug NullReferenceException on iOS, write lots of Debug.Log for objects, and in build settings enable development build and script debugging.

This could happen if GameObject.FindGameObjectWithTag is used in Awake or Start because the object may not be created when Awake or Start is executed. The issue may not show up in editor since in editor the objects may already be there but they may not be created when running the app on iOS. One workaround is to do it at point of usage when the object has been created.

No comments:

Post a Comment