- Home /
HELP! TextMesh Pro not working for Android after upgrading from 2018.2 to 2018.4 (NullReferenceException at TMPro.TMP_Settings.get_defaultStyleSheet() )
Things were working fine in Unity 2018.2. I upgraded to Unity 2018.4, which automatically upgraded my TMP package to v1.3. IL2CPP. Building using cloud build, 2018.4.1f1 (same as editor), and gradle (everything default, I do not customize gradle at all).
Right now, things work fine in the editor and on iOS. But on Android, I get this error logged for every TMP element trying to render:
.
Unity : NullReferenceException: Object reference not set to an instance of an object. at TMPro.TMP_Settings.get_defaultStyleSheet () [0x00000] in :0 at TMPro.TMP_StyleSheet.get_instance () [0x00000] in :0 at TMPro.TextMeshProUGUI.Awake () [0x00000] in :0 (Filename: currently not available on il2cpp Line: -1)
.
I have tried uninstalling and reinstalling TMP via the package manager. I have imported TMP essential assets and I have run the GUID remapper tool (which did not find anything to update). I have opened TMP settings and checked that the default style sheet links to a file that exists (Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset). I have temporarily modified (change something, save project, revert change, save project) this file and many other TMP files to force TMP to regenerate them - this did cause many unexpected changes in the git diff, but it didn't help the result on device. None of the above has helped.
.
Anyone? I'm going on several weeks now without my Android version being broken. :(
Answer by jamesk5 · Jun 17, 2019 at 03:14 AM
This turned to be a result of enabling split APKs by architecture and not properly utilizing the OBB files that are part of the build. You can't install a split APK directly from cloud build, I don't think.
There are two options to fix:
Disable split APKs by architecture.
If split APKs is enabled, test only by uploading the APKs to the Play Console. Make sure you upload the OBB files in the release, too (by clicking the plus next to the APKs you've uploaded).
EDIT: Hosting OBB files isn't enough, apparently. I don't know, but it seems they need to be loaded intot he game by script similar to how you would with asset bundles.
.
EDIT: Scrap the above. Export as ABB format (available in cloud build android advanced settings). This made everything work. You upload a single ABB file to the play console, and it processes it into separate APKs which contains resources in them instead of using OBB files.
.
Apparently ABB format was already doable via script, meaning you had to define a pre-build method. But now ABB is available in the CB front end which is great.
Your answer
Follow this Question
Related Questions
Connect Andorid Phone and get error 1 Answer
Make sphere shoot to Touch.position error 1 Answer
TextMeshProUGUI not showing on Android build 0 Answers
errors building on android 0 Answers