Search Unity

Unity UI Cannot override key Slider base class methods

Discussion in 'UGUI & TextMesh Pro' started by Justin-Wasilenko, Jul 14, 2021.

  1. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    104
    I am looking to extend the base Unity UI Slider class, specifically to remove the checks for accepting Left mouse button clicks only:
    Code (CSharp):
    1.  
    2. public class Slider...
    3. private bool MayDrag(PointerEventData eventData)
    4. {
    5.     return IsActive() && IsInteractable() && eventData.button == PointerEventData.InputButton.Left;
    6. }
    7.  
    But everything is hidden in private methods if I try and override OnPointerDown.

    Buttons and Toggles have been no problem to override and allow Right clicks, but the Slider class is sealed uptight. Everything is hidden in private methods instead of protected.

    @phil-Unity How can I can get Right mouse button clicks to affect the slider and move it correctly?