Hello everyone, I’ll link my code here it’s for touch purpose now I’m facing a problem with this code due to this error
assets/Joystick.cs(35,32): error CS1525: unexpected symbol ‘position’, expecting ‘)’, ‘,’,', ‘[’, or ‘=’
using UnityEngine;
using System.Collections;
public class Joystick : TouchLogicV2
{
public Transform player = null;
public float playerSpeed = 2, maxJoyDelta = 0.13f;
private Vector3 oJoyPos, joyDelta;
private Transform joyTrans = null;
void Start ()
{
joyTrans = this.transform;
oJoyPos = joyTrans.position;
}
void OnTouchBegan()
{
touch2Watch = TouchLogicV2.currTouch;
}
void OnTouchMovedAnywhere()
{
if (TouchLogicV2.currTouch == touch2Watch)
{
joyTrans.position = MoveJoyStick();
}
}
Vector3 MoveJoyStick()
{
float x = Input.GetTouch (touch2Watch).position.x / Screen.width,
y = Input.GetTouch (touch2Watch).position.y / Screen.height,
Vector3 position = new Vector3 (Mathf.Clamp(x, oJoyPos.x - maxJoyDelta, oJoyPos.x + maxJoyDelta),
Mathf.Clamp(y, oJoyPos.y - maxJoyDelta, oJoyPos.y + maxJoyDelta), 0);
return position;
}
}