private fps_Input input; //输入信息记录的脚本 void Start() { LockCursor = true; //将光标锁定 parameter = this.GetComponent <fps_PlayerParameter>(); //获取组件 input = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <fps_Input>(); //通过根据物体的名称找到物体 }
void Start() { LockCursor = true; parameter = this.GetComponent <fps_PlayerParameter>(); //赋值parameter,通过该脚本所在物体中找到组件fps_PlayerParameter input = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <fps_Input>(); //赋值input,通过游戏物体的标签区寻找组件fps_Input }
void Start() { LockCursor = true; parameter = this.GetComponent <fps_PlayerParameter>(); input = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <fps_Input>(); }