Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Graphics.DrawTexture not working in Standalone Player

Discussion in 'Scripting' started by smilefr, Mar 20, 2012.

  1. smilefr

    smilefr

    Joined:
    Dec 4, 2010
    Posts:
    108
    Hi!

    I will try my luck here since it seem more populated...

    I have developed a small script to display a round Minimap (Here is the code):


    Code (csharp):
    1.  public RenderTexture minimapTexture;
    2.     public Material circleMaskMaterial;
    3.      
    4.     void OnGUI()
    5.     {
    6.      
    7.            if(Event.current.type == EventType.Repaint)
    8.             Graphics.DrawTexture(new Rect(0,0, 70, 70), minimapTexture,circleMaskMaterial);
    9.     }
    10.  
    The camera's target texture is set to the RenderTexture.

    For some reason the standalone player does not show anything when it works perfectly in editor mode, i don't know what to do.

    Any help is greatly appreciated!
     
  2. smilefr

    smilefr

    Joined:
    Dec 4, 2010
    Posts:
    108
    I managed to make it work by setting the quality to Fantastic, thats weird, maybe a unity related bug?
     
  3. Profas

    Profas

    Joined:
    Oct 15, 2009
    Posts:
    73
    Hey, Could you please create a bug report with repro project. Thanks!
     
  4. bigwings

    bigwings

    Joined:
    Nov 18, 2009
    Posts:
    28
    I'm having a similar problem: Graphics.Drawtexture doesn't work in the stand alone when used with a material.
    It works fine in the editor.

    Putting the stand alone in fantastic doesn't help, nor does putting my shaders in the resources folder.

    Anyone?
     
  5. bigwings

    bigwings

    Joined:
    Nov 18, 2009
    Posts:
    28
    I found how to fix it: It looks like graphics.drawtexture does not work when used with a material, with deferred lighting in the stand alone.

    Looks like a bug to me.
     
  6. KyleHatch85

    KyleHatch85

    Joined:
    Dec 13, 2011
    Posts:
    99
    thanks bigwings, driving me mad, thankfully i didn't really need point light shadows, so no need for deferred lighting.

    Guess it'll be annoying for those who need deferred lighting and render textures.....
     
  7. Edge-Lee

    Edge-Lee

    Joined:
    Jul 13, 2012
    Posts:
    4