Question by
SahilAppDeveloper · Jul 10, 2017 at 12:37 PM ·
scripting problem
error CS1525: Unexpected symbol `else'.Please help.
here is the code.
using System.Collections;
using System.Collections.Generic;
public class WorldInteraction : MonoBehaviour {
NavMeshAgent playerAgent;
void Start()
{
playerAgent = GetComponent<NavMeshAgent> ();
}
void Update()
{
if (Input.GetMouseButtonDown (0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject)
GetInteraction ();
}
void GetInteraction()
{
Ray interactionRay = Camera.main.ScreenPoinToRay(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;
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
[HELP] How to lock input key? 1 Answer
Ammo Script 0 Answers
Unable to save generated/rendered Texture2D to use for billboard 3 Answers
How do I get the screen to fade in when a trigger is triggered? 0 Answers
script causes unity to crash 0 Answers