Alright so I was trying to make a “click to move” movement system but I came across a couple errors that i’m not sure how to address. For context I used ‘||’ to indicate where the line ended.
The errors I’m receiving are
Assets/Scripts/World Interaction.cs(26,37): error CS1026: Unexpected symbol ,', expecting
)’ ||
Assets/Scripts/World Interaction.cs(26,58): warning CS0642: Possible mistaken empty statement ||
Assets/Scripts/World Interaction.cs(26,58): error CS1026: Unexpected symbol ,', expecting
)’ ||
Assets/Scripts/World Interaction.cs(26,74): error CS1525: Unexpected symbol )', expecting
;’ or `}’
As for the actual scripts well; ||
using System.Collections; ||
using System.Collections.Generic; ||
using UnityEngine;
public class WorldInteraction : MonoBehaviour { ||
NavMeshAgent playerAgent;
// Use this for initialization
void Start ()
{
playerAgent = GetComponent<NavMeshAgent>();
}
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButtonDown (0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject)
GetInteraction();
}
void GetInteraction()
{
Ray interactionRay = camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit interactioninfo;
if (Physics.Raycast)(interactionRay, out interactioninfo, Mathf.Infinity)
{
GameObject interactedObject = interactioninfo.collider.gameObject;
if(interactedObject.tag == "Interactable Object")
{
Debug.Log("interactable interacted.");
}
else
{
playerAgent.destination = interactioninfo.point;
}
}
}
}