Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
二重にRequireComponentしてみる
[RequireComponent(typeof(RequiredCharaName))]
public class RequiredCharacterStatus : MonoBehaviour {
// キャラクターのステータスを保持するクラス
public int maxHp = 100;
public int hp = 80;
public int atk = 50;
void Start(){
RequiredCharaName charaName = gameObject.GetComponent<RequiredCharaName>();
Debug.Log(charaName.charaName + "「いっちばーん!」");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.