##環境
macOS Mojave 10.14.4
Unity2018 C#
##やりたいこと
C#スクリプトからStandardAssetのFPSControllerのXSensitivityとYSensitivityを変更したいです。
##参考にさせていただいたサイト
https://living-sun.com/ja/c/181102-changing-firstpersoncontroller-mouselook-sensitivity-c-unity3d-unityscript.html
##書いたコード
sensiSet.cs
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityStandardAssets.Characters.FirstPerson; 5 6public class sensiSet : MonoBehaviour 7{ 8FirstPersonController fps; 9 10// Use this for initialization 11void Start() 12{ 13 GameObject fpsObj = GameObject.Find("FPSController"); 14 fps = fpsObj.GetComponent<FirstPersonController>(); 15} 16 17void Update(){ 18 if(Input.GetMouseButton(1)){ 19 fps.mouseLookCustom.XSensitivity = 1; 20 fps.mouseLookCustom.YSensitivity = 1; 21 }else{ 22 fps.mouseLookCustom.XSensitivity = 2; 23 fps.mouseLookCustom.YSensitivity = 2; 24 } 25} 26}
##エラーコード
Assets/sensiSet.cs(19,29): error CS1061: Type `object' does not contain a definition for `XSensitivity' and no extension method `XSensitivity' of type `object' could be found. Are you missing an assembly reference? Assets/sensiSet.cs(20,29): error CS1061: Type `object' does not contain a definition for `YSensitivity' and no extension method `YSensitivity' of type `object' could be found. Are you missing an assembly reference? Assets/sensiSet.cs(22,29): error CS1061: Type `object' does not contain a definition for `XSensitivity' and no extension method `XSensitivity' of type `object' could be found. Are you missing an assembly reference? Assets/sensiSet.cs(23,29): error CS1061: Type `object' does not contain a definition for `YSensitivity' and no extension method `YSensitivity' of type `object' could be found. Are you missing an assembly reference?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。