I am making a TPS 3D game for smartphones.
You can move the camera angle by dragging the screen, and you can move the character by moving the joystick in the UI.
At this time, if you move the joystick on the UI, the camera angle will move at the same time as the character.
So, I want to prevent the camera angle input from being accepted only when I tap the joystick, but I'm having trouble doing that.

Right now I'm trying to do the above process by imitating the code written on this site, but I'm not sure how to use it.
I tried to copy and paste it as it is and accept input only when IsTouchPress is true, but the camera angle does not move at all.

I don't know what the code current.IsPointerOverGameObject () stands for in the code written on the site.
When I googled, I found this API, but I didn't understand it well.

Please tell me what current.IsPointerOverGameObject () stands for.

Also, the site I'm referring to now seems to describe the processing when Sprite and UI overlap, but is this method actually not usable in 3D games?

Error message
Corresponding source code

It is a script to operate the angle of the camera by tapping.
In the input process on the second line in LateUpdate, I want to not accept input in the case of tap input on JoyStick.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
namespace CSharpScript
    // [ExecuteInEditMode, DisallowMultipleComponent]
    public class UnkomanCameraControl: MonoBehaviour
        private GameObject target;
        public Vector3 offset;
        [SerializeField] private float distance = 4.0f;
        [SerializeField] private float polarAngle = 87.0f;
        [SerializeField] private float azimuthalAngle = 270f;
        [SerializeField] private float minPolarAngle = 2.0f;
        [SerializeField] private float maxPolarAngle = 130.0f;
        [SerializeField] private float mouseXSensitivity = 5.0f;
        [SerializeField] private float mouseYSensitivity = 5.0f;
        [SerializeField] GameObject InstantiateObj;
        bool JoyStickOnPointer;
        void Awake ()
            target = InstantiateObj.GetComponent<SampleScene>(). Unkoman.transform.GetChild (2) .gameObject;}

        void LateUpdate ()
            if (target == null) return;
            updateAngle (Input.GetAxis ("Mouse X"), Input.GetAxis ("Mouse Y"));
            var lookAtPos = target.transform.position + offset;
            updatePosition (lookAtPos);
            transform.LookAt (lookAtPos);
            // Show/hide cursor&lock/unlock
            if (Input.GetMouseButtonDown (1))
                Cursor.visible = false;
                Cursor.lockState = CursorLockMode.Locked;
            if (Input.GetKeyUp (KeyCode.Escape))
                Cursor.visible = true;
                Cursor.lockState = CursorLockMode.None;
        void updateAngle (float x, float y)
            if (target == null) return;
            x = azimuthalAngle --x * mouseXSensitivity;
            azimuthalAngle = Mathf.Repeat (x, 360);
            y = polarAngle + y * mouseYSensitivity;
            polarAngle = Mathf.Clamp (y, minPolarAngle, maxPolarAngle);

        void updatePosition (Vector3 lookAtPos)
            if (target == null) return;
            var da = azimuthalAngle * Mathf.Deg2Rad;
            var dp = polarAngle * Mathf.Deg2Rad;
            transform.position = new Vector3
                 lookAtPos.x + distance * Mathf.Sin (dp) * Mathf.Cos (da),
                 lookAtPos.y + distance * Mathf.Cos (dp),
                 lookAtPos.z + distance * Mathf.Sin (dp) * Mathf.Sin (da)

The following two are the codes written on the site i am referring to to stop accepting touch input when you tap the UI.

using UnityEngine.EventSystems;
public bool IsPointerOverGameObject ()
    EventSystem current = EventSystem.current;
    if (current! = null)
        if (current.IsPointerOverGameObject ())
            return true;
        foreach (Touch t in Input.touches)
            if (current.IsPointerOverGameObject (t.fingerId))
                return true;
    return false;
public bool IsTouchPress ()
    if (Input.GetMouseButtonDown (0))
        if (! IsPointerOverGameObject ())
            return true;
    return false;
What I tried

At first, I tried using EventTrigger to not accept the input processing of the above camera code only while JoyStick is pressed.
Specifically, I created a variable that becomes true when OnPointerDown and false when OnPointerUp, and input processing is not executed while that variable is true.
However, that would make it impossible to control the camera angle with another finger while touching the JoyStick.
So, I'm trying to refer to the site I wrote above.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

  • Answer # 1

    IsPointerOverGameObject () returns true, false whether the pointer is over the object.
    In the article that came out by google, IsPointerOverGameObject is false on the UI, so it was written that you can use this code to determine whether the input part is on the UI, but myself When run with, IsPointerOverGameObject was always true as long as it was in the game screen, whether the pointer was in the UI or in the background.
    So I couldn't use IsPointerOverGameObject to determine the input on the UI.

    Also, this time I posted a question without being able to organize my mind, so it became a strange question.
    So, the problem of the title of this post has not been solved, but I will solve it by myself.
    I'm sorry.