Trying to activate a component on start.
GameObject has script called “Motor.” “Motor” and “NetworkCar” are on the same object.
Getting an object reference error in the start method. Am I supposed to reference the object from which to get the component? Will it not use the owner by default?
Unity is also giving me a context error on “myMotor,” even though it is declared and used in same method? Thanks in advance for any help.
using UnityEngine;
using System.Collections;
public class NetworkCar : Photon.MonoBehaviour {
public GameObject myCamera;
// Use this for initialization
void Start () {
myMotor = GetComponent<Motor> ();
if (photonView.isMine) {
myCamera.SetActive ( true );
myMotor.enabled = true;
}
}
}