I have a very simple scene with a single cube, a camera and a light. I’ve written a C# class which processes user input swipe gestures from either touches or from the mouse, and also for specific regions of the screen.
I’ve attached the script twice as components of the camera. One to service swipes on the left hand side and one to service swipes on the right (there is a long drawn out reason for this that I won’t go into here). All works fine and the scripts function as expected.
I’d now like to move the cube in the direction of the swipe, but can’t figure out how I can get the values from the swipe controllers (attached to the camera) to the code which animates the cube.
In short, (as titled) - how can I access values from my swipe controller scripts in my cube controller script. Also, if you have the same script attached to the same object more than once, how does Unity differentiate between the two?
Hope that makes sense,