- Home /
Question by
canaltunoz · Nov 26, 2015 at 07:53 PM ·
script error.net
unexpected symbol `:' in class, struct, or interface member declaration Pls Help
public class TouchControl : MonoBehaviour { private var dist : float; private var toDrag : Transform; private var dragging = false; private var offset : Vector3;
function Update() {
if(Input.GetMouseButtonDown(0))
{
var hit : RaycastHit;
var v3 : Vector3;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray,hit))
{
if(hit.transform.gameObject == selectedObject)
{
toDrag = hit.transform;
dist = hit.transform.position.z - Camera.main.transform.position.z;
v3 = Vector3(Input.mousePosition.x, Input.mousePosition.y, dist);
v3 = Camera.main.ScreenToWorldPoint(v3);
offset = toDrag.position - v3;
dragging = true;
}
}
}
if (Input.GetMouseButton(0))
{
if (dragging)
{
v3 = Vector3(Input.mousePosition.x, Input.mousePosition.y, dist);
v3 = Camera.main.ScreenToWorldPoint(v3);
toDrag.position = v3 + offset;
}
}
if (Input.GetMouseButtonUp(0))
{
dragging = false;
}
}
}
Hi guys im trying to set finger swipe drag with script but it gives error :( Im newbie in scripting so can anyone help me with this pls. Ty for ur interest
Comment
Answer by tanoshimi · Nov 26, 2015 at 07:53 PM
Is this meant to be Javascript? What's that public class TouchControl : MonoBehaviour
doing there?
Yea, i think the problem was the public class TouchControl : $$anonymous$$onoBehaviour .. it's no need to write in Js ..
Your answer
