下記のエラーコードがでる
Assets\script\navmesh.cs(23,32): error CS1503: Argument 1: cannot convert from 'UnityEngine.Transform' to 'UnityEngine.Vector3'
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.AI; 5 6public class navmesh : MonoBehaviour 7{ 8 9 10 NavMeshAgent navMesh; 11 12 void Start() 13 { 14 navMesh = GetComponent<NavMeshAgent>(); 15 navMesh.updateRotation = false; 16 navMesh.updateUpAxis = false; 17 } 18 19 20 // Update is called once per frame 21 void Update() 22 { 23 navMesh.SetDestination(GM.instance.livingRoomPos); 24 } 25}
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.UI; 5 6public class GM : MonoBehaviour 7{ 8 #region シングルトン 9 public static GM instance; 10 private void Awake() 11 { 12 if(instance == null) 13 { 14 instance = this; 15 DontDestroyOnLoad(this.gameObject); 16 } 17 else 18 { 19 Destroy(this); 20 } 21 } 22 #endregion 23 24 25 public Transform livingRoomPos; 26 27 public Transform kitchenPos; 28 29 public Transform bedPos; 30 31 public Transform toiletPos; 32 33 public Transform washHandroomPos; 34 35 public Text text; 36}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。