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

Question Bug LoadAssetAsync Shader Missing or Not set Correctly

Discussion in 'Addressables' started by pontos_developer, Jun 4, 2020.

  1. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    Hi, when I used AAS to Remoload Prefab and Instantiate object result it seems like werid.
    upload_2020-6-4_18-7-54.png
    My Script All Missing?
    Just Call LoadAssetAsync().Completed+=obj=>Instantiate(obj);
     

    Attached Files:

  2. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    OK I got the problems,script all normal and worked correct,but the shader was missing or not set Correct!
    I tried to pack the shader code in addressable or pack material still not use,like this.
    upload_2020-6-5_12-1-36.png
    I also added shader to Always Include Shaders list in Project Settings --> Graphics.
    and rebuild my asset, not working .
    Can someone help me? Thank you!
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    I'll circulate this with the team for some guidance. Which version of Addressables are you using?
     
  4. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    566
    Are you using fast mode or packed mode? If you're using packed mode, in order to properly load bundles into the editor, you need to build them for the platform you're deving on (Standalone Windows or OSX or Linux).
     
  5. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    Thanks. I used 1.8.3ver AAS.
    I selected existing mode,most shader value are missing cause it pink.
    I tryed this:
    Code (CSharp):
    1. LoadAssetAsync<GameObject>(label).Completed+=obj=>
    2. {
    3.   var go = obj.result;
    4.   var materials = go.GetComponentsInChildren<Material>();
    5.   foreach (var mat in materials)
    6. {
    7.    mat.shader=Shader.Find(mat.shader.name);
    8. }
    9. }
    Seems strange but resloves some problem,now only missing few shader.

    Important: When build for the platforms shader value is correct! not pink.
    Problem only happened on Unity Editor.
    Even though it only happen on Editor,I hope this issue can be resolved.
    After all, this problem bothered me when I was developing.

     
  6. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    566
    I just told you the resolution for that problem in my previous post.
     
    pontos_developer likes this.
  7. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    Yeah I have tried it,still has that problem.
    I might be wrong in some steps?
    Thanks for help!
     
  8. CameronND

    CameronND

    Joined:
    Oct 2, 2018
    Posts:
    81
    Are you loading bundles built for a different platform in the editor?
     
  9. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    Right! I load the bundle for the Android.
    Is that the problem?Or other way to resolve it?
    Thank you
     
  10. CameronND

    CameronND

    Joined:
    Oct 2, 2018
    Posts:
    81
    You have to build bundles for the editor platform OS. So if you are on a windows machine you build and test using windows bundles, likewise for Mac.

    It's a pain, we go through the same thing. But thats just how it works. Android bundles are built for android, not windows or mac.