FPSControllerをシーン遷移させて、遷移した先でオブジェクトをLookatを使ってFPSControllerの方向に向けようとしたのですが、色々調べても全く上手くいきません。どうすればよいでしょうか?回答よろしくお願い致します。
C#
1//シーン遷移 2 3using System.Collections; 4using System.Collections.Generic; 5using UnityEngine; 6 7public class DontDestory : MonoBehaviour { 8 9 public GameObject hero; 10 11 void Awake() 12 { 13 // 特定のGameObject 14 DontDestroyOnLoad(hero); 15 16 } 17}
C#
1 2//プレイヤーの方向に向ける 3 4using System.Collections; 5using System.Collections.Generic; 6using UnityEngine; 7using UnityEngine.UI; 8 9public class Kinoko : MonoBehaviour { 10 11 Transform Player; 12 public RawImage kinoko001; 13 14 // Use this for initialization 15 void Start () { 16 17 Player = transform.Find("FPSController"); 18 19 20 21 22 } 23 24 // Update is called once per frame 25 void Update () { 26 27 kinoko001.transform.LookAt(Player); 28 29 } 30}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。