Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: kretin on May 11, 2014, 07:50:59 PM

Title: Change UIGrid maxPerLine with button
Post by: kretin 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.  

Title: Re: Change UIGrid maxPerLine with button
Post by: ArenMook on May 13, 2014, 07:24:54 AM
"OnClick" is case sensitive. You have it start with a lowercase character.
Title: Re: Change UIGrid maxPerLine with button
Post by: kretin on May 13, 2014, 06:46:58 PM
That's it!

Thank you so much :)