基本的にBOSSのデータにアクセスする方法と同じだった
同じコンポーネントを使用しているので、どのオブジェクトにアクセスしたい?ってのを
明確にしないとアクセスできなかった
スクリプトを書く
using System.Collections; using System.Collections.Generic; using UnityEngine; using MoreMountains.CorgiEngine; //CorgiEngineにアクセス public class MyPlayer : MonoBehaviour{ GameObject myPlayer; //検索したPlayer入れる用 private Health health; //Health変数 void Start(){ myPlayer = GameObject.FindWithTag("Player"); //playerをtagで検索 } void Update(){ health = myPlayer.GetComponent<Health>(); //PlayerのHealthコンポーネント取得 Debug.Log(health.CurrentHealth); //とりあえず、テストで現在のHPを取得 } }