- Home /
Override Void Not Working
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class ClimbInteractable : XRBaseInteractable
{
void Update() {
OnSelectEnter();
OnSelectExit();
}
protected override void OnSelectEnter(XRBaseInteractor interactor)
{
base.OnSelectEnter(interactor);
if(interactor is XRDirectInteractor)
Climber.climbingHand = interactor.GetComponent<XRController>();
}
protected override void OnSelectExit(XRBaseInteractor interactor)
{
base.OnSelectExit(interactor);
if(interactor is XRDirectInteractor)
{
if(Climber.climbingHand && Climber.climbingHand.name == interactor.name)
{
Climber.climbingHand = null;
}
}
}
}
So, I'm working on a climbing script for my VR or XR whatever you call it and the protected overrides aren't working I always get this in my console: Assets/ClimbInteractable.cs(14,26): error CS0115: 'ClimbInteractable.OnSelectEnter(XRBaseInteractor)': no suitable method found to override. I also get: Assets/ClimbInteractable.cs(22,26): error CS0115: 'ClimbInteractable.OnSelectExit(XRBaseInteractor)': no suitable method found to override
Didn't mean to put the void Update in there but that makes no difference so I don't really care about the void Update but I do need some help with this protected overrides stuff and also I'm on 2019.4.11f1
Answer by tkati · Feb 20, 2021 at 11:08 AM
I'm not familiar with XRBaseInteractable, put if I remember correctly the base function needs to be labled as virtual to be overridable in addition to the function.
edit: maybe getting my languages mixed up though too.
Your answer
![](https://koobas.hobune.stream/wayback/20220613025503im_/https://answers.unity.com/themes/thub/images/avi.jpg)