How can I access FirstPersonController script variables?

I am working on stamina and sprinting features with the unity standard assets first person controller. I have been following some tutorials on how to access gamecomponents and so on but I cannot understand why my script does not find the FirstPersonController class at all?

I have also tried to use character motor script (all tutorials use this), but it seems it cease to exist at all in the standard assets.

This is what I have done in another script that is in the same game object as the FPSController when i tried to access it.

public FirstPersonController controller;

	void Start () {

		controller = GetComponent<FirstPersonController>();
	}

I am still very fresh in programming and even the directions towards the solution would be much appreciated! Thanks!

You need to do it like this now in 5 apparently…

public UnityStandardAssets.Characters.FirstPerson.FirstPersonController controller;

and then just something like …

controller.m_WalkSpeed = (10);

or, you can start with …

using UnityStandardAssets.Characters.FirstPerson;

and then go about it the old way.

I’ve used both of these methods recently without trouble.

Hi,

You’re on the good way ! Now with what you’ve already made you can access all the public variables (and only these one, that why public/private is specified) of the FPC script. You just need to do:

controller.nameOfPublicVariable;

or

controller.nameOfPublicFunction();

all you have to do is make m_WalkSpeed public