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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Material missing when load UI prefab from assetbundle with a custom font as dependency in 5.3.5p3

Discussion in 'UGUI & TextMesh Pro' started by JasonAtUnity, Jun 14, 2016.

  1. JasonAtUnity

    JasonAtUnity

    Joined:
    Oct 8, 2015
    Posts:
    4
    repro step:

    1.Open My project with unity5.3.5p3, load Scenes/Main.unity.
    2.Run game in editor.
    3.'Canvas' has a component 'TestPanel' will load three UI Prefab by three ways.
    4.Load UI prefab from assetbundle with a custom font 'greennum' as the dependency.When instantiate the prefab, the font material is missing.
    5.Load UI prefab from AssetDataBase, the 'greennum' 's material is perfect.
    6.Load UI prefab from assetbundle, and then manually load 'greennum' asset, then set the Text.font to the manual font asset, the font's material is perfect too.

    my project is uploaded here.
     

    Attached Files:

    Last edited: Jun 14, 2016
  2. JasonAtUnity

    JasonAtUnity

    Joined:
    Oct 8, 2015
    Posts:
    4
    I found another issue may be connected to this.When I load some sprites packed into one atlas from assetbundle as automatic dependencies, the atlas's texture may be lost sometime.

    All these probrems never show up in unity5.3.4f1.

    Can anybody help me?
     
  3. sedlu

    sedlu

    Joined:
    Nov 12, 2012
    Posts:
    11
    Having the same problem, too.

    In the new assetbundle system of Unity 5, prefabs in a bundle do not load depended assets from other bundles when the prefabs are loaded from the bundles. The depended assets are not actually loaded until the prefabs are instantiated.

    This fact leads to some situations which are quite hard to deal with. Users can not unload assetbundles themselves right after the prefabs are loaded. To make them work correctly, all these bundles must be unloaded after the prefabs are all instantiated.

    Hope this could be fixed.

    Thanks.