Unity

Unity Image要素からファイル名を取得する

ちょっと躓いたのでメモ Image image; public Text text; public void Start() { image = GetComponent<Image> (); text.text = image.sprite.name; } spriteを一回指定しないといけないのね...</image>

gameobjectはcomponentではないのね

MissingComponentException: There is no 'GameObject' attached to the "ThirdSaitenButton" game object, but a script is trying to access it. のようにエラーが出たが解決したため備忘用 スクリプトから自身のgameObjectを扱いたい場合は var obj = thi…