【发布时间】:2020-06-06 04:21:08
【问题描述】:
所以我正在为我的 FPS 游戏制作一个选项菜单,到目前为止,我已经开发了一个音频滑块,使用与我尝试为鼠标制作灵敏度滑块相同的想法。它似乎获得了所需的信息并将其发送到游戏对象,但之后它似乎没有将其发送到控制 FPS 相机的其他脚本。
//this script controls taking information from a slider in the menu
public float mouseSens;
public void SetSens(float mouseSpeed)
{
mouseSens = mouseSpeed;
}
//this is the fps camera script
public GameObject mouseInfo; //I tried linking to the game object that holds the information
public float mouseSensitivity; //this is the float that controls mouse sensitivity.
// Start is called before the first frame update
void Start()
{
//I originally put the float mouseSensitivity = mouseInfo code here but it didn't work.
}
private void Awake()
{
float mouseSensitivity = mouseInfo.GetComponent<SettingsMenu>().mouseSens; //this is my current try to make it work.
}
对此的任何帮助将不胜感激。如果这篇文章格式错误,很抱歉,这是我第一次在堆栈上发帖。 :)
【问题讨论】: