Semicolon expected before end of line
I'm trying to do a GetComponent (I've tried two ways) and it keeps expecting a semicolon before the parenthesis that defines the component I'm asking for.
Method One:
var healthScript: eventObj.GetComponent.<script>('healthScript');
ERROR:
Assets/Scripts/saveScript.js(6,49): UCE0001: ';' expected. Insert a semicolon at the end.
Method Two:
var healthScript: eventObj.GetComponent('healthScript');
ERROR:
Assets/Scripts/saveScript.js(6,40): UCE0001: ';' expected. Insert a semicolon at the end.
It seems to be expecting a semicolon right before the parenthesis in both codes.
var healthScript: eventObj.GetComponent*semicolon expected here*('healthScript');
EDIT: Just to clarify, the eventObj has been declared previously as "var eventObj : GameObject;". I don't think that is part of the issue, but I thought I might as well include that.
Your answer
Follow this Question
Related Questions
GetComponent is not a member of Object 0 Answers
Trigger enabling component works in one statement but not another? 1 Answer
Where to put ; 2 Answers
';' expected. Insert a semicolon at the end. Already have one 1 Answer
Argument Exception: GetComponentFastPath? built .exe of the game crashes! 3 Answers