Joystick pack free, error CS0019; Operator `/' cannot be applied to operands of type `UnityEngine.Vector2' and `UnityEngine.Vector2'
I just download the Joystick pack free from the asset store, which apparently works fine for everybody else, but I get and error saying I can't not use the operator '/' among the same type of data. I had been looking around but I am unable to understand what is going on error appears at:
input = (eventData.position - position) / (radius * canvas.scaleFactor);
Any suggestions please? Thanks.
public virtual void OnPointerDown(PointerEventData eventData)
{
OnDrag(eventData);
}
public void OnDrag(PointerEventData eventData)
{
cam = null;
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
cam = canvas.worldCamera;
Vector2 position = RectTransformUtility.WorldToScreenPoint(cam, background.position);
Vector2 radius = background.sizeDelta / 2;
input = (eventData.position - position) / (radius * canvas.scaleFactor);
FormatInput();
HandleInput(input.magnitude, input.normalized, radius, cam);
handle.anchoredPosition = input * radius * handleRange;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612215423im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Detecting joystick disconnect 2 Answers
How to create two invisible joysticks 0 Answers
Joy Num change via Script 1 Answer
Sprite is drawn over canvas element 0 Answers
Working with multiple joystick models 0 Answers