First, I just want to say this is a really neat package. I am definitely considering upgrading from the free version after I learn the ins and outs of the code more thoroughly. Right now I am trying to implement two "left" and "right" buttons that scroll a panel when they are moused over. I seem to have the scrolling part right, but I read that since NGUI does not continuously fire events (from
this thread), I will have to assign isOver to a local variable which I named "pressed".
public class MouseOverScroll : UIButton {
public enum Direction{Left, Right};
public Direction dir = Direction.Left;
public GameObject dragpanel;
UIDraggablePanel dps;
public bool pressed = false;
void Start () {
dps = dragpanel.GetComponent<UIDraggablePanel> ();
}
void Update() {
if(pressed) {
if (dir == Direction.Left) {
dps.SendMessage("Scroll", 0.5f);
}
else if (dir == Direction.Right) {
dps.SendMessage("Scroll", -0.5f);
}
}
}
public override void OnHover (bool isOver)
{
base.OnHover (isOver);
pressed = isOver;
}
}
However this started giving me the error:
"The same field name is serialized multiple times in the class or its parent class. This is not supported: Base(Monobehaviour) pressed". I guess it doesn't like what I am doing in void OnHover(), but why?