calling a variable from another method (in another file)

This is probably a very “noob” question…but I am attempting to call a variable from another C# file and am having difficulty. I will provide my code…

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;



public class UserVitalStats : MonoBehaviour
{
    CharacterController charController;
    FPCharacterController playerController; //THIS IS WHERE I CANT GET IT TO WORK

    void Start()
    {
        charController = GetComponent < CharacterController> ();
        playerController = GetComponent<FPCharacterController>(); //ALSO WHERE I CANT GET IT TO WORK
    }

CALLING FROM

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPCharacterController : MonoBehaviour
{

    public Rigidbody rigidBody;
    public FPCharacterController playerController;

 void Start()
    {
        playerController = GetComponent<FPCharacterController>();
    }
}

I had other code involved but just used the necessary to shorten it…if I need to I can put the full code

What are you trying to do? Why do you have the FPCharacterController with a variable to an FPCharacterController?

If UserVitalStats is on the same GameObject as the FPCharacterController, then the GetComponent call will work as you have written.

Wow now I see where I went wrong haha. Cut and paste issues. Thanks for the extra set of eyes with the FP Character controller situation! I’ve been looking at code for hours :eyes: