2D Toolkit Forum
2D Toolkit => Support => Topic started by: Ultroman on March 20, 2016, 05:32:53 pm
-
EDIT: I noobed out on this one. The solution was tragicomical. If you want to know what was wrong, it's in the next post.
Hello.
Any idea why it would say that my MainCamera-variable (a tk2dCamera) is null, when I try to access it in the Start() method of my MainGameScript? (see my attachment)
It works fine inside Unity, but when I build for PC, and run it, it throws nullpointer exceptions at me, for trying to read the position of the camera in Start().
NullReferenceException: (null)
UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at C:/buildslave/unity/build/artifacts/generated/common/editor/SerializedPropertyBindings.gen.cs:74)
UnityEditor.Editor.GetSerializedObjectInternal () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:154)
UnityEditor.Editor.get_serializedObject () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:147)
UnityEditor.MaterialEditor.OnEnable () (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1544)
It worked fine before, when using a normal Unity camera.
Thanks in advance!
-
Sorry, guys. I noobed out on this one.
I had forgotten to change which scene it should build, and I had just created a new gamescene before switching to tk2d.