Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question GUI.Button drawn twice

Discussion in 'UGUI & TextMesh Pro' started by Drethon, Dec 31, 2023.

  1. Drethon

    Drethon

    Joined:
    May 30, 2016
    Posts:
    10
    I'm using GUI.Button as shown in the code below, but I'm getting the same image drawn twice (once appears to be original texture size?). Any thoughts on why this is happening?

    Code (CSharp):
    1.     public Texture2D MenuButtonImage;
    2.  
    3.     void OnGUI()
    4.     {
    5.         if ( GUI.Button ( new Rect ( 0 , 0, 100, 50 ), MenuButtonImage ) )
    6.         {
    7.         }
    8.  
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,166
    its on 2 things?
     
  3. Drethon

    Drethon

    Joined:
    May 30, 2016
    Posts:
    10
    Only on one as far as I can tell, and even being on two, it shouldn't have different sizes.

    I added another button with a different image and am seeing the same thing, except the outer image is the one in the screenshot, and the inner image is the correct one assigned to the new button.
     
  4. Drethon

    Drethon

    Joined:
    May 30, 2016
    Posts:
    10
    Ah, figured out it draws weird any time I scale up the image. I guess I have to make all my sprites larger that the highest resolution I expect them to be?