Author Topic: Calling UIButtonTween with C#  (Read 3122 times)

Sandsnake

  • Guest
Calling UIButtonTween with C#
« on: August 29, 2013, 08:11:01 AM »
using UnityEngine;
using System.Collections;

public class MainMenu : MonoBehaviour {
   
   public string CurrentProduct="X26P";
   
         
   private string OnBody() {
      UIButtonTween.Play(true) panelMainGUI.TopLeft.CurrentInfo.BODY;
      CurrentProduct="BODY";
      Debug.Log ("currently selected product is " +CurrentProduct);
      return CurrentProduct;
      
   }   
}

I seem to not be understanding the format or the syntax that the tween call has to take, if someone could maybe help me understand this it would be great

What i am tryign to achieve is the following:
I have 6 radio buttons. Each one OnActivate tweens a texture into the screen, however i want it to tween the texture out when a new checkbox is selected, BEFORE that checkbox tweens its texture onto the screen.

Have been searching for about 3 hours now, any help appreciated

Sandsnake

  • Guest
Re: Calling UIButtonTween with C#
« Reply #1 on: August 29, 2013, 10:07:26 AM »
Ok, i now realsie what i really actually need is just how to use the UITweener syntax, but as i dont understand how to read the class diagram, i am getting helluva lost....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Calling UIButtonTween with C#
« Reply #2 on: August 29, 2013, 05:08:45 PM »
I don't understand what you're trying to do there. Tweens are for moving states from A to B. Not sure what your CurrentProduct is for, or what your Play() has to do with some "panelMainGUI.TopLeft.CurrentInfo.BODY" -- or what it is for that matter.

Using tweens is simple: TweenPosition.Begin(targetGameObject, targetPosition, ...etc)

Sandsnake

  • Guest
Re: Calling UIButtonTween with C#
« Reply #3 on: August 29, 2013, 10:10:17 PM »
I don't understand what you're trying to do there. Tweens are for moving states from A to B. Not sure what your CurrentProduct is for, or what your Play() has to do with some "panelMainGUI.TopLeft.CurrentInfo.BODY" -- or what it is for that matter.

Using tweens is simple: TweenPosition.Begin(targetGameObject, targetPosition, ...etc)

Idea is to create a radio button array that will show a texture when the radio button is selected, and hide it when deselected
Plus this code has changed, and now is much simplified. It is the exact syntax format for a tween call that i was not grasping