Search Unity

[Bug?] "Assertion failed on expression: 'm_GpuProgram'" when accessing mainTexture

Discussion in 'Addressables' started by MagicDesignEmerick, Jul 5, 2019.

  1. MagicDesignEmerick

    MagicDesignEmerick

    Joined:
    Oct 4, 2017
    Posts:
    26
    Hi, I'm trying to upgrade our loading system to be based on addressables, but I've ran in a little issue.

    I'm loading prefabs from a scriptable object that is an addressable, and then call an init function using data from this prefab before instantiating it (Loading a skeleton from Spine actually).

    When I'm loading directly the prefab all goes well, but upon switching to Addressable I get the following error when trying to access a material referenced by the prefab :

    Code (CSharp):
    1. Assertion failed on expression: 'm_GpuProgram'
    2. UnityEngine.Material:get_mainTexture()
    3.  
    While the calling code is roughly :
    Code (CSharp):
    1. if (material.mainTexture == null)
    2. {
    3.     //do stuff
    4. }
    Note that this assert doesn't seem to impact anything, besides my unit tests. Is there something I'm missing in my setup of addressable?


    I'm trying to get a simpler repro case but simplifying it makes me currently get a null ref on the access to the material even though it's not null in the prefab..
     
  2. jrhowa

    jrhowa

    Joined:
    Feb 3, 2015
    Posts:
    5
    I'm having something like this.

    When I instantiate prefab that is stored in a assetBundle I get:

    Code (CSharp):
    1. Assertion failed on expression: 'm_GpuProgram'
    2. UnityEngine.Material:get_mainTexture()
    Calling like this:
    Code (CSharp):
    1. var prefab = myLoadedBundle.LoadAsset(assetName);
    2. var go = Instantiate(prefab) as GameObject;
     
  3. jrhowa

    jrhowa

    Joined:
    Feb 3, 2015
    Posts:
    5
    This ended up being a problem with the bundle being built for the wrong platform that it was running on.