レス書き込み
スレへ戻る
写
レス栞
レス消
【ゲームエンジン】Unity初心者質問スレBuild4
PC,スマホ,PHSは
ULA
べっかんこ
公式(スマホ)
公式(PC)
で書き込んでください。
名前
メール
引用切替:
レスアンカーのみ
>>329 > http://s.kota2.net/1588213392.png > > ボタンを押すと5の星だけが表示されるスクリプトなのですが、 > 親になっている星のオブジェクトをpublicで参照するやり方ではなくて > Findでヒエラルキーから探してくるやり方に変更したら動かなくなりました。 > > > using System.Collections; > using System.Collections.Generic; > using UnityEngine; > > public class Button5star : MonoBehaviour//ボタンにアタッチ > { > //public Transform STARParent; //publicで参照するのをやめる > Transform STARParent = GameObject.Find("starParent").GetComponent<Transform>();//Findで探したい > > public void button5star() > { > for (int i = 0; i < STARParent.childCount; ++i) // for文 > { > STARParent.GetChild(i).gameObject.SetActive(false);//STARParentの子を一旦全部消す > STARParent.transform.Find("star (5)").gameObject.SetActive(true); > } > } > } > > ----------------------------- > starParentは空のオブジェクトで子のstarは画像のspriteです。 > Findで探している部分が間違っているのでしょうか?
ローカルルール
SETTING.TXT
他の携帯ブラウザのレス書き込みフォームはこちら。
書き込み設定
で書き込みサイトの設定ができます。
・
ULA
・
べっかんこ(身代わりの術)
・
べっかんこ(通常)
・
公式(スマホ)
・
公式(PC)[PC,スマホ,PHS可]
書き込み設定(板別)
で板別の名前とメールを設定できます。
メモ帳
(0/65535文字)
上
下
板
覧
索
設
栞
歴
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.009s