Mobile Setup Guide
-
Last updated
-
Last updated
Setting your character for mobile devices is very easy. All mobile assets like Buttons and Mobile Joystick can be easily connected to any animal without creating any dependency, using and .
All mobile assets needs the Unity Event System and Graphic Raycast component attached to the Root Canvas in order to work properly
The Canvas that will be used as the Holder for all the buttons must have the Graphic Raycaster component and the Event System GameObject needs to be on the scene.
You can find all the Mobile Button prefabs inside this Folder:
Assets\Malbers Animations\Common\Prefabs\Mobile Input
When adding any of these prefabs on your scene you will need to add them as a child of a canvas.
All the mobile buttons will Raise Events with any Value (Float, Int, Bool, Etc) and those event will be listened by the Animal. and it will act depending of the Event connection with the Animal.
E.g. The Jump Mobile Button has an Event Trigger component with 2 Base Event Data: Pointer Down and Pointer Up. Which register when the Button is Pressed and Released. They Use the Set Jump Event with its boolean value.
And this Event is listened by the Animal on its MEvent Listener Component
And it's connected to the StatePin
and StatePinByInput
Methods. Allowing the Animal to Jump.
This setup can be done to Activate any State. You just need to change the ID.
To add the Default list of listeners to an animal you can use the Context menu -> Create Event Listeners on an Animal Component.
This will add this Default list of listeners and it will connect them to the Animal Component
You can find Button Examples you can use inside as buttons for your Mobile Canvas they are located here:
For example lets Study the Jump Button prefab
This is connected to the Animal via an MEvent Listener. Which is connected to the Jump Logic on the Animal. It Changes the Input Value of the Jump State:
To connect any other State; Recreate this values with a different MEvent asset and a different State ID Value.
The mobile Joystick prefab uses the component. It calculates a Vector2 value that later is used to move the Camera or the Animal
To Connect a State with a button you can use any of the prefabs provided for those State Buttons on the
You will see that the button Invokes a Set Jump when is Pressed, sending a bool Value = True; and Invoke again the when the button is released, sending a bool Value = False;
To Connect a Mode with a button you can use any of the prefabs provided for those Mode Buttons on the
To Connect a Stance with a button you can use any of the prefabs provided for those Stance Buttons on the