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

Metal error on 4.6.3 [Solved]

Discussion in 'iOS and tvOS' started by Stream, Feb 24, 2015.

  1. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    Last edited: Feb 26, 2015
  2. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
  3. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,600
    bug report with *small* repro please
     
  4. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    What?
     
  5. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    He's asking if you'd submit a bug report that includes a small project that will reproduce ('repro') the error.
     
  6. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    I submited a bug (link in first post). But I cant include source code, sorry
     
  7. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I think you have about zero chance of them fixing your bug if you can not submit code that reproduces it.

    They are not wanting your actual project, just a create new project with the bare minimum required to reproduce the bug.
     
    Meltdown likes this.
  8. alexatino

    alexatino

    Joined:
    Dec 11, 2014
    Posts:
    6
    Got the same issue - but only on 64 Bit Device (iPhone 5s)
     
  9. Wudio

    Wudio

    Joined:
    Jun 29, 2013
    Posts:
    3
    I'm hitting this as well. only when i build with metal on iphone 6.

    i am on unity 4.6.4 and xcode 6.2
     
  10. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    @alexatino @Wudio Could you please submit bugs with small reproduction projects and post the bug number here? Without reproduction project it's almost impossible to fix the problem.
     
  11. KS_Vince

    KS_Vince

    Joined:
    Feb 28, 2013
    Posts:
    5
    I have the same problem too. I have XCode 6.3 and Unity 5.01.
    It seems it comes from metal as I don't get the error when I change Graphics API from automatic to OpenGL ES 3.0.
    On automatic my app crashes on iPhone6 with this error :
    /SourceCache/AcceleratorKit/AcceleratorKit-17.7/Framework/MTLTexture.m:215: failed assertion `MTLTextureDescriptor has invalid pixelFormat (0).'
     
  12. Vince82

    Vince82

    Joined:
    May 9, 2014
    Posts:
    3
    Changing my TIFF atlases to PNG and also changing an ASTC format to PVRTC fixed the problem.
    Not sure the TIFF atlases caused a crash, but I know the ASTC format did.
     
    Last edited: Apr 20, 2015
  13. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    I finally realized where the problem is. Error start up when I display avatars from Facebook. I do it like this
    Code (CSharp):
    1. WWW www = new WWW(url); // For example https://graph.facebook.com/10204916518582922/picture?type=square&height=100&width=100
    2.  
    3. Texture2D texture = new Texture2D(width, height, TextureFormat.DXT1, false);
    4.  
    5. yield return www;
    6.  
    7. image.sprite = Sprite.Create(texture, new Rect(0, 0, width, height), Vector2.zero);
    8. www.LoadImageIntoTexture(texture);
    @povilas @Alexey Could you please help me?
     
    Last edited: May 14, 2015
  14. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Hey Stream,

    If you're just looking for a solution to load a WWW fetched image into a texture I use the following:

    Code (csharp):
    1. WWW request = new WWW(url);
    2. retryCount = 3;
    3. do{
    4.   yield return request;
    5.   --retryCount;
    6. } while(request.error != null && retryCount > 0);
    7.  
    8. if (request.error == null) {
    9.   Texture2D tex = request.texture;
    10.   //
    11.   // This will obviously need to be amended for your needs, you won't have the same
    12.   // custom shader as I'm using.
    13.   //
    14.   Shader shader = Shader.Find ("Custom/CustomUnlitTextureOnly");
    15.   Material material = new Material (shader);
    16.   material.mainTexture = tex;
    17.  
    18.   //
    19.   // Now use the material as you like.
    20.   //
    21. }
    Note, as shown here http://docs.unity3d.com/Manual/iphone-unsupported.html DXT textures are not supported on iOS.
     
    Last edited: May 14, 2015
    Meltdown and Stream like this.
  15. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    @larku, soo, it works on Metal?
     
  16. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I'm not sure about that, but DXT textures are not supported on iOS so I'd make the assumption that your issue is actually due to you trying to use a DXT texture - I use the above method and I've never had any issues, though I have not tested explicitly with metal (I don't have a metal compatible device).

    I suggest trying and see if it works (you've got nothing to lose).
     
    Stream likes this.
  17. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    @larku, thank you very much! I have not used your code, but you are proposed the right idea. The problem was in TextureFormat.DXT1. I just changed it to RGB24 and everything worked! :)
     
    Meltdown and larku like this.
  18. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Excellent!
     
  19. Bilelmnasser

    Bilelmnasser

    Joined:
    May 16, 2014
    Posts:
    18
    this error is been thrown iphone 5s/6/6 plus on unity 5.2.1 without even any DXT compression in any script
     
  20. Sprakle

    Sprakle

    Joined:
    Jun 8, 2013
    Posts:
    31
    Same here, on 5.2.1p4

    It happened after I switched a lot of our sprites to using Crunched compression and/or an atlas. I'll see if I can get a small project up soon.
     
  21. Bilelmnasser

    Bilelmnasser

    Joined:
    May 16, 2014
    Posts:
    18
    SOLUTION : Force OpenGles 2.0 because is supported by all Apple Hardware !
     
  22. mentorstudio

    mentorstudio

    Joined:
    Nov 30, 2015
    Posts:
    1
    Thanks bilelmnasser its helpfull.
     
    Bilelmnasser likes this.