Search Unity

Stage Select

Discussion in 'Immediate Mode GUI (IMGUI)' started by mgyanm, Jun 21, 2013.

  1. mgyanm

    mgyanm

    Joined:
    Jul 6, 2012
    Posts:
    9
    I have no problem to make a swipe control GUI and trigger a method when user clik on the image, but i cant make my GUI looks like this, anyone have an idea ?

    $GUI.JPG
     
  2. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    That is pretty basic math. All you need is just a little bit scale calculations, probably some alpha to make smooth layer interpolation and depth calculation with GUI.depth.
     
  3. mgyanm

    mgyanm

    Joined:
    Jul 6, 2012
    Posts:
    9
    Lacost : i'm not really familiar with GUI.depth, i use offset for a stage selection like this, but the image wont be like the photo i shared. so you're saying that i have to make different gui depth for each layer?
     
  4. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    I think, it is posible to make such interface without GUI.depth.
    All you need is sorted array of image rectangles, and draw them in order of sort.
    Something like this:

    Declare image class:
    Code (csharp):
    1.  
    2. public class Image
    3. {
    4.      public Rect rect;
    5.      public Texture texture;
    6. }
    7.  
    And use it
    Code (csharp):
    1.  
    2. /// Array of your images, sort it to draw in order whar you need
    3. public List<Image> Image= new List<Image>();
    4. ...
    5.  
    6. for(int i = 0; i < Image.Count; i++)
    7. {
    8.      GUI.DrawTexture(Image[i].rect, Image[i].texture),
    9. }
    10.  
     
  5. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Patico, is write. If you will draw them in correct order you will get same effect.
     
  6. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    Well, what effect do you mean?