how to Click world space UI buttons?(with first person cc)

I saw unity put out their own first person character controller(cc) so I was just playing around with it and wanted to make an elevator. I decided to try onPointerClick for the first time ever and I cant get it to work. That could be because I’m not understanding the intended use of it or my mine thought is that the unity cc turns “off” the mouse as far as clicking goes and that’s why it isn’t working. Either way I was wonder if anyone either knows why my approach isn’t working or knows a better way to be doing this? Here’s the code I’m using for the elevator. The UI button is supposed to call “callElevator()”.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class Elevator : MonoBehaviour, IPointerClickHandler
{
    Vector3 firstFloor;
    Vector3 secondFloor;
    public Transform top;

    public bool isUp = false;

    private void Start()
    {
        firstFloor = gameObject.transform.localPosition;
        Debug.Log("First floor" + firstFloor);
        secondFloor = top.localPosition;
        Debug.Log("Second floor" + secondFloor);
    }

    void Update()
    {

        if (Input.GetKeyDown(KeyCode.C))
        {
            if (gameObject.transform.localPosition == firstFloor || gameObject.transform.localPosition == secondFloor)
            {
                Debug.Log(gameObject.transform.localPosition);

                callElevator();
            }
        }
    }
    public void OnPointerClick(PointerEventData pointerEventData)
    {
        //Output to console the clicked GameObject's name and the following message. You can replace this with your own actions for when clicking the GameObject.
        Debug.Log(name + " Game Object Clicked!");
    }
    public void callElevator()
    {
        if (!isUp)
        {
            StartCoroutine(elevatorUp());
            isUp = true;
        }
        else
        {
            StartCoroutine(elevatorDown());
            isUp = false;
        }
    }

 

    public IEnumerator elevatorUp()
    {
        float totalMovementTime = 5f; //the amount of time you want the movement to take
        float currentMovementTime = 0f;//The amount of time that has passed
        while (Vector3.Distance(transform.localPosition, secondFloor) > 0)
        {
            currentMovementTime += Time.deltaTime;
            transform.localPosition = Vector3.Lerp(firstFloor, secondFloor, currentMovementTime / totalMovementTime);
            yield return null;
        }
    }

    public IEnumerator elevatorDown()
    {
        float totalMovementTime = 5f; //the amount of time you want the movement to take
        float currentMovementTime = 0f;//The amount of time that has passed
        while (Vector3.Distance(transform.localPosition, firstFloor) > 0)
        {
            currentMovementTime += Time.deltaTime;
            transform.localPosition = Vector3.Lerp(secondFloor, firstFloor, currentMovementTime / totalMovementTime);
            yield return null;
        }
    }
}

The code above does not connect to callElevator() (lines 35 to 39) so I’m not sure why you expect it to work.

Is the Debug.Log() call on line 38 firing in the OnPointerClick() method? Is that the correct method name, spelled correctly? Have you reviewed the documentation for all the requirements to have that method called?

No the debug doesnt get called either I wanted to see if I could get the debug call to work before attaching it to the callElevator(). I used the IPointerClickHandler unity3d documentation. https://docs.unity3d.com/2018.4/Documentation/ScriptReference/EventSystems.IPointerClickHandler.html
With that documentation I got lines (35-39) to work in a brand new project without the unity first person cc