Author Topic: Gotcha for those working on mobile  (Read 2383 times)

eedok

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Gotcha for those working on mobile
« on: September 24, 2012, 11:47:10 PM »
Lost about 40 minutes tracking down this issue with my UITextures causing a NullReferenceException when I built my game for mobile. After a few builds of just debug.logging where the issue occurred I found it was this line in UITexture causing the issue: Shader.Find("Unlit/Texture"); which lead to me to this thread: http://forum.unity3d.com/threads/151413-Unlit-Texture-Null-reference

Fixing it was a matter of putting an empty gameObject in the scene and putting a material with that shader on it, so that it would be included in the build.


Hope I put enough keywords and search terms here for people with this problem that are googling it to save them some time
EDIT: another term: UnityEngine.Material..ctor (UnityEngine.Shader shader)
« Last Edit: September 25, 2012, 11:25:41 AM by eedok »

dlewis

  • Guest
Re: Gotcha for those working on mobile
« Reply #1 on: September 25, 2012, 01:12:31 AM »
I wonder if this is the reason that one of my UITextures keeps getting set to nothing...

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Gotcha for those working on mobile
« Reply #2 on: September 25, 2012, 10:03:40 AM »
I wonder if this is the reason that one of my UITextures keeps getting set to nothing...

An error with UITextures losing their assignment was fixed quite recently - have you got the latest version?