Hi
In your tutorial for Scripting (http://docwiki.unity3d.com/uploads/Main/Scripting%20Tutorial.pdf in section 6 (Accessing Components), I keep getting an error.
I apply the “Switch.js” script to my Spotlight as instructed. This script contains a GetComponent(Follow).target line to call on the target variable inside the Follow.js script.
However, when I apply the Switch.js to my Spotlight as instructed, Unity keeps giving me a "Switch.js: BCE0019: ‘target’ is not a member of ‘UnityEngine.Component’. I’ve checked my scripts dozens of times with no clue to the problem.
For reference, the code is as follows:
Follow.js
var target : Transform;
function Update () {
transform.LookAt(target);
}
Switch.js
var switchToTarget : Transform ;
function Update () {
if (Input.GetButtonDown("Jump"))
GetComponent(Follow).target = switchToTarget;
}
Note that I’m doing this in Unity iPhone and have a feeling this is the reason why I’m getting an error. Any solution to this? Are there any script tutorials for iPhone?