Hi the code below gives the error below and I have no idea why? I’m guessing I’m assigning something wrong but I cant seem to find why on any answers or just my own trouble shooting!
Code:
var coins : GameObject[];
var trigger = false;
var target : GameObject;
var speed : float;
function Start ()
{
coins = GameObject.FindGameObjectsWithTag("Coin");
target = gameObject.transform.position;
speed = 5.0;
}
function Update ()
{
var step = speed * Time.deltaTime;
if (trigger == true)
{
coins = Vector3.MoveTowards(gameObject.transform.position, target.transform.position, step);
}
}
Errors:
Assets/Scripts/Gameplay Functionality Script.js(75,44): BCE0022: Cannot convert 'UnityEngine.Vector3' to 'UnityEngine.GameObject[]'.
Assets/Scripts/Gameplay Functionality Script.js(19,39): BCE0022: Cannot convert 'UnityEngine.Vector3' to 'UnityEngine.GameObject'.