Author Topic: Change UIGrid maxPerLine with button  (Read 1506 times)

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Change UIGrid maxPerLine with button
« on: May 11, 2014, 07:50:59 PM »
I'm new to NGUI and having a bit of trouble changing maxPerLine. I've got a UIGrid (CardGrid06) being populated with either 6 or 12 cards using PlayMaker.

Right now I have a button that deals 6 and a button that deals 12. If it's 6 then I want 3 lines (default), if it's 12 then I want change it to 4 lines, but I can't get it to change.

My code on the 12 button is this:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ButtonCards12 : MonoBehaviour {
  5.  
  6.         // Use this for initialization
  7.         void Awake () {
  8.  
  9.         }
  10.         void onClick () {
  11.                 GameObject.Find ("CardGrid06").GetComponent<UIGrid>().maxPerLine = 4;
  12.                
  13.                
  14.         }
  15. }
  16.  


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Change UIGrid maxPerLine with button
« Reply #1 on: May 13, 2014, 07:24:54 AM »
"OnClick" is case sensitive. You have it start with a lowercase character.

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Change UIGrid maxPerLine with button
« Reply #2 on: May 13, 2014, 06:46:58 PM »
That's it!

Thank you so much :)