Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

GameObject Monobehaviour.Texture -> Null

Discussion in 'Windows' started by DanMorton, Jun 27, 2014.

  1. DanMorton

    DanMorton

    Joined:
    Nov 27, 2012
    Posts:
    2
    I have a gameobject in my scene with a script that contains objects called "Elements" these object contain various variables one of which is called "NormalTexture". I have assigned the texture by dropping it on the property in the editor but when running on windows phone the "NormalTexture" property evaluates to null.

    public abstract class Element
    {
    [...]
    public Texture2D NormalTexture, PressTexture;
    }
    public class ElementButton : Element { }

    public class myGui : MonoBehaviour
    {
    ElementButton startButton, backButton;

    void Start()
    {
    if (!startButton.NormalTexture)
    Debug.Log("StartButton=Bad Texture");
    }
    }

    //please note that startButton.NormalTexture is assigned in the Editor. By dropping a texture on it.
    This only appears to be an issue on Win Phone 8. Any suggestion are greatly appreciated.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    By saying that "This only appears to be an issue on Win Phone 8. Any suggestion are greatly appreciated.", which platforms did you try it on?
     
  3. DanMorton

    DanMorton

    Joined:
    Nov 27, 2012
    Posts:
    2
    I am sorry for not being more clear.

    I have tested this on Android and iOS builds. It also works as expected in the Editor.
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,627
    I think you should make a minimal example and report a bug.