Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[SOLVED] Prefab NullReferenceException

A topic by RonDMC created Dec 19, 2016 Views: 1,813 Replies: 11
Viewing posts 1 to 11
(1 edit)

Hello there!

I noticed that after I made a Super Text Mesh into a prefab object I can't change any of the values and I get a NullReferenceException error. In order to change it, I have to drag it into the inspector, change the values, then apply back to the prefab. The prefab appears to work fine when called and I can even change the values through code while the game is testing however. Below is the error from the console.

NullReferenceException: Object reference not set to an instance of an object
SuperTextMeshEditor.OnInspectorGUI () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:192)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1235)
UnityEditor.DockArea:OnGUI()
Developer (1 edit)

Hey! I'm trying to recreate this, but can't seem to get the error to occur. What version of STM are you using?

I'm using 1.3 and tried re-downloading/re-importing it. The error will only pop up when clicking on the object with the Super Text Mesh component. I tried creating some new Super Text Mesh objects and dragging them into the prefab folder thinking the old ones were corrupted but the same error gets thrown.

Developer

Could you give v1.4 a shot? I know it still says "beta" on the store page, but it's actually the version i just submitted to the asset store! I've fixed a ton of bugs and it's kinda impossible for me to bugfix older versions. (I'm actually going to be taking v1.3 and below down afterwards)

Sorry!

I bought it off of the Unity store so once it updates on there I'll give it a try and let you know how it goes, thanks!

I updated and imported the new STM but I'm getting the same error.

Developer

Does it happen when you create a new Super Text Mesh object from the GameObject menu, then create a prefab of that? I believe somewhere between v1.2 and v1.3 there was an odd bug that would effect older textmeshes because of how they used to be created.

If this doesn't work I have a few more guesses, but hopefully you just have to re-create the GameObject?

Yeah. I tried creating a new game object using the menu and dragging it in as a prefab and same error pops up.

Developer

Could you give me the current error log? The code moved around a lot since the update and I'm trying to figure out what line is calling this, because I still can't seem to recreate this yet. Also, what version of Unity are you using?

Here's the error it's giving me now.

NullReferenceException: Object reference not set to an instance of an object
SuperTextMeshEditor.OnInspectorGUI () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:192)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1235)
UnityEditor.DockArea:OnGUI()

I'm using Unity 5.4.1f1. I just deleted and reimported the asset again but same thing error pops up. Don't know if this means anything but the documentation resource still says 1.3 while the asset store says 1.4.

Developer

Ah okay, what's happening right now is one of the reasons I prefer selling on itch.io... I submitted v1.4 to the asset store using Unity 5.4.2, meaning v1.4 doesn't appear for anyone with a lower Unity version number until I submit using an Older version of Unity. (Even though I know it'll run fine on any version of Unity 5.4) So... you're still using v1.3 right now! I need to redownload an older version of Unity and resubmit with that to avoid this in the future.

Send me an email at support[@]kaiclavier.com with your asset store invoice, and I'll get you an itch.io key so you can get the latest version!

Awesome! Looks like the error went away after the real update. Thanks so much for the support!