Split-screen Touch Issue
Hey there developers,
I have been in some issues related the split-screen.
I have created two canvas and different data on it. I have coded a specific script on the first part so that the user can interact with an object and on the second panel, I created a scroll view from the UI.
Whenever I scroll on the right side the left side also considers that touch for it and moves. How do I sense the touch in the specific area?
I will also paste the code I applied on the object for interacting with it. Here's the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Turn : MonoBehaviour
{
protected Vector3 posLastFame;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
posLastFame = Input.mousePosition;
if (Input.GetMouseButton(0))
{
var delta = Input.mousePosition - posLastFame;
posLastFame = Input.mousePosition;
var axis = Quaternion.AngleAxis(-90f, Vector3.forward) * delta;
transform.rotation = Quaternion.AngleAxis(delta.magnitude * 0.2f, axis) * transform.rotation;
}
}
}
I want this code to be applied only on just first screen, that in which the object is placed.
Kindly help.
Requesting,
Nisp270998
Your answer
Follow this Question
Related Questions
Pause menu done exactly according to tutorial doesen't work 2 Answers
Joystick doesn't work properly on the left half of the screen 1 Answer
Input.GetAxis("Vertical") not working on Mobile Phone 1 Answer
How to create touch controls depending on the touch position? 1 Answer
New User trying to use a UI button to interact with objective markers 0 Answers