The name 'GM' does not exist in the current context

GM.cs Script:

using System.Collections;
using UnityEngine;

public class GM : MonoBehaviour {

    public static float vertVel = 0;

	void Start () {
		
	}

	void Update () {
		
	}
}

MoveCam.cs Script[error on GM.vertVel]:

using UnityEngine;

public class MoveCam : MonoBehaviour {

    void Start () {
        
        //Move Main Camera On Y Axis                     X  Z  Y
        GetComponent<Rigidbody>().velocity = new Vector3(0, GM.vertVel, 4);
	}
	
	void Update () {
		
	}
}

Thank you! :slight_smile:

you need to do the same GetComponent to access GM

GetComponent<Rigidbody>().velocity = new Vector3(0, GetComponent<GM>().vertVel, 4);

@WillNode it now says: The type or namespace name ‘GM’ could not be found(are you missing a using directive or an assembly reference?) on the .