playMaker

Author Topic: How do I access a static member?  (Read 2705 times)

tiggus

  • Playmaker Newbie
  • *
  • Posts: 6
How do I access a static member?
« on: July 08, 2013, 10:54:45 AM »
Probably a simple explanation for this but it is driving me nuts.  Normally when I use get/set property on a object I get a nice drop down of properties that are exposed from the object and able to get/set them to my hearts content.  This doesn't seem to apply to static members but I cannot find an equivalent way to get them without writing custom action for each one individually.

Trying to do this with some of the NGUI objects such as UICamera and very few of the public members are nonstatic.

Specifically I am interested in UICamera.fallThrough and UICamera.lastTouchPosition, see API reference here: http://www.tasharen.com/ngui/docs/class_u_i_camera.html

Am I stuck with writing custom actions for every single static member I need to fetch?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do I access a static member?
« Reply #1 on: July 09, 2013, 01:49:54 AM »
Hi,

 I am afraid so :) I do write custom actions to access static members, and also complex methods that I want to expose in a simpler manner.

Also, be careful with LastTouchPosition, it's not persistant, at least when I last wanted to work with it, it gave me some really odd results. What do you want to achieve with this?

bye,

 Jean

tiggus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: How do I access a static member?
« Reply #2 on: July 09, 2013, 09:46:21 AM »
Thanks, I am using NGUI's event system(why reinvent the wheel?) for my game camera so was going to use their position variables for getting where on the screen the user touched.

When I played with it I was having some trouble with UICamera.lastTouchPosition so I changed to using UICamera.lastHit instead and this seems to be working better, see below:

Code: [Select]
using UnityEngine;
using HutongGames.PlayMaker;

[ActionCategory("NGUI")]
[Tooltip("Last raycast hit prior to sending out the event. This is useful if you want detailed information about what was actually hit in your OnClick, OnHover, and other event functions.")]
public class UICameraLastHit : FsmStateAction
{
[Tooltip("Returns the last raycast hit point from UICamera.")]
public FsmVector3 pointLastHit;

public override void Reset ()
{
pointLastHit = new FsmVector3 { UseVariable = true };
}

public override void OnEnter()
{
DoAction();
Finish();
}

void DoAction() {
pointLastHit.Value = UICamera.lastHit.point;
}

}
« Last Edit: July 09, 2013, 10:28:43 AM by tiggus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do I access a static member?
« Reply #3 on: July 10, 2013, 06:15:51 AM »
Hi,

 Good. Also , don't hesitate to get in touch with ngui guys or on their forum, I am sure they will tell you what's best for your needs.

bye,

 Jean