I can’t work out how to get component or send a message from a game object to Unity’s standard Rigidbody First Person Controller using GetComponent. Could somebody kindly tell me the syntax?
So far I have tried: player = GameObject.Find ("RigidBodyFPSController");followed by
One way would be by finding the gameObject that has the “RigidbodyFirstPersonController” and then send a message :
//include the namespace
using UnityStandardAssets.Characters.FirstPerson;
private RigidbodyFirstPersonController fpController;
void Start(){
//find the FirstPersonController
fpController = GameObject.FindObjectOfType(typeof(RigidbodyFirstPersonController)) as RigidbodyFirstPersonController;
//Send your message
fpController.SendMessage("YourFunction");
}