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

DrawTexture different resolutions

Discussion in 'Scripting' started by Falcon1337, Dec 30, 2014.

  1. Falcon1337

    Falcon1337

    Joined:
    Dec 29, 2014
    Posts:
    3
    hello everyone,

    i have a script for steering wheel i want to scale the drawtexture to different resolutions

    it looks like this








    but what i want like this





     
    Last edited: Jan 4, 2015
  2. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    You need to change the wheelsize variable (line 3) to Screen.width/10 or whatever number you like.
     
    Last edited: Dec 30, 2014
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    It's far easier if you use the new UI in Unity 4.6, in which case you'd make the canvas scaler component scale with screen height, and anchor the graphic in the corner.

    --Eric
     
  4. Falcon1337

    Falcon1337

    Joined:
    Dec 29, 2014
    Posts:
    3
    but how to do this its hard
    is there any method to do this ?
     
  5. Falcon1337

    Falcon1337

    Joined:
    Dec 29, 2014
    Posts:
    3
    when i create gui.button(rect(screen.with*0.5,screen.height*0.5,250,250),"ee")

    its working fine with different resloutions
    but i dont know whats the wrong with wheelPosition = new Rect( screen.with*0.5,screen.height*0.5, wheelSize, wheelSize );

    its not working
     
  6. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539