using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class VersionUpdater
{
static VersionUpdater()
{
GameObject.FindGameObjectWithTag("Version").GetComponent<TextMesh>().text = "v"+PlayerSettings.bundleVersion;
}
}
Gives this ugly error:
*System.NullReferenceException:
at (wrapper managed-to-native) UnityEngine.GameObject:GetComponent (System.Type)
at UnityEngine.GameObject.GetComponent[TextMesh] () [0x00000] in :0
at VersionUpdater…cctor () [0x0000b] in /Users/Luke/Desktop/Unity/Unity Projects/Now You’re Dead/Now You’re Dead/Assets/Editor/VersionUpdater.cs:11
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly)
*