So, I wanted a left button, a right button, and a rotate button to show up when I am on mobile. I made the buttons, put them inside a Rect Transform with the MobileControlRig script, set up just like the Controls prefabs I found in the StandardAssets for CrossPlatformInput.
The Left/Right buttons are set up like the ones in the MobileAircraftControls sample, except that they do not have the Button info at the bottom that seems to just change the sprite, and has an empty OnClick().
The Left and Right buttons have the ButtonHandler.cs script attached to them, with the Name value set to Horizontal. They have an EventTrigger PointerDown and PointerUp script attached, with it set to Editor And Runtime, ButtonHAndler.SetAxisNegativeState (or PositiveState for Right) and Left(ButtonHandler) or Right(ButtonHandler).
The Rotate Button is set up the same as Left and Right, except that the Name handed to ButtonHandler.cs is “Jump”, and they EventTrigger is triggering Jump to the ButtonHandler.
So, I stuck some Debug.Log lines in ButtonHandler.cs, and I’m not getting any sign that ButtonHandler.cs is receiving any input.
I’m not sure what other info I need to be looking at in order to figure out where the issue is. It seems to me that something is not right with my EventTrigger and/or ButtonHandler setup, since ButtonHandler isn’t having any of its functions called, but I’m not sure how to debug further on this.
Any recommendations? What could I be doing wrong?
I really don’t want to just use the existing prefabs, partly because I want to really understand how to do this myself, and partly because they don’t have what I want.
Thanks!
~maquis