Hi
Im currently making a multiplayer racing game and I need to use the getcomponent code in my script. I am trying to get this script from Unity's car in the Vehicles package that can be downloaded in the standard assets. However, the two car scripts im trying to get, CarController and CarUser control both have namespaces which are `namespace UnityStandardAssets.Vehicles.Car`
I have never come accross namespaces before so I dont really know how to use them. I looked up the documentation and created this code
using UnityEngine;
using System.Collections;
namespace StandardAssets.Vehicles.Car
public class NetworkPlayer : MonoBehaviour {
public GameObject Mycamera; //Mycamera to follow cars
void Start () {
Mycamera.SetActive(false); //Dont set active
GetComponent().enabled = true; // enable them when multiplayer starts
GetComponent().enabled = true;
}
// Update is called once per frame
void Update () {
}
}
However this code gives me the errors :
Assets/Network/NetworkPlayer.cs(5,6): error CS1003: Syntax error, `.' expected
Assets/Network/NetworkPlayer.cs(5,44): error CS8032: Internal compiler error during parsing, Run with -v for details
Any help would be appreciated as I'm really stuck here.
Thanks in Advance
Dok
↧