I am trying to get my mouse to work on 2 cameras on a 2d plain
I currrently have 2 cams running side by side on a 2d game. I can switch cameras from A to B or vice versa. When i switch the cameras my mouse stops working on the secondcamera.
I think i need to change the main bit into my secondcamera but im not sure how, can any one help?
Part i need to change to switch to secondcamera for mouse to work i think. Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
My mouse code : if (Input.GetMouseButtonUp(0)) { selected = false; } if (selected == true) { Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); transform.position = new Vector2(cursorPos.x, cursorPos.y); }
Your answer
![](https://koobas.hobune.stream/wayback/20220612204049im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
click area is moved when camera is rorated 0 Answers
Rendering a Canvas as Screen Space - Camera - Google Cardboard 0 Answers
Please help me with my mouse pointer 0 Answers
SmoothDamp not going to target position 0 Answers
Mouse Events with Render Texture 0 Answers