An action needs to be generated when a button is held down in unity5 , this button is created inside a Canvas UI , which when held down needs to call a method generated in a script.
The problem is generated because it only performs the action when it is pressed and not while it is pressed.
The solution will be using the OnPointerDown method . We will need to add the EventSystem and Events libraries, and including the IPointerDownHandler, IPointerUpHandler methods.
We will generate a condition inside the Update method asking if the button is being pressed and in this way we will invoke the desired action.
We will add this script to the desired object, incorporating the desired action. As in the following example it is a script calling a method.