Search Unity

Clipping Rect Problem.

Discussion in 'Immediate Mode GUI (IMGUI)' started by Marc, Mar 17, 2008.

  1. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    I have this code where i try to create a menu. It consists of an outer clipping rect and a larger Rect inside it containing all menu elements. Psedu code below.

    Code (csharp):
    1.  
    2.  
    3. int distance = 0;
    4.  
    5. void OnGUI() {
    6. // Clipping Rect
    7. GUI.BeginGroup(new Rect(0, 0, 200, 200);
    8.  
    9. // Menu items
    10. GUI.BeginGroup(new Rect(0, distance, 200, 600);
    11.   // Draw Menu Items as GUI.Buttons
    12. GUI.EndGroup();
    13.  
    14. GUI.EndGroup();
    15. }
    16.  
    I then scroll the items up and down using the distance variable. Lets say each row is 100 pixels high so to see next row i would lerp the distance varaible towards -100

    The buttons which are outside the height of the clipping rect at start are then apearing like they should when the distance variable is decreased. The problem is the buttons no longer respond to mouse hover or click.

    Anyone have any idea on what is going on?

    Regards,
    Marc
     
  2. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    [Deleted] Error code 40 :oops: