Hi again,
I’m trying to convert a java script from a tutorial to C# code. Here’s the code that I’m trying to convert.
var switchToTarget : Transform;
function Update () {
if (Input.GetButtonDown("Jump"))
GetComponent(Follow).target = switchToTarget;
}
Here’s the C# code that I’ve converted.
using UnityEngine;
using System.Collections;
public class SwitchC : MonoBehaviour {
public Transform switchToTarget;
void Update () {
if(Input.GetButtonDown("Jump")){
GetComponent(Follow2).target = switchToTarget;
}
}
}
I don’t know what’s wrong. May be I overlooked something. Any suggestion’s appreciated.
Cheers,
Desmond