[過去ログ]
【ゲームエンジン】Unity初心者質問スレBuild4 (1002レス)
【ゲームエンジン】Unity初心者質問スレBuild4 http://mevius.5ch.net/test/read.cgi/gamedev/1585478112/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
423: 423 [sage] 2020/05/12(火) 15:39:06.10 ID:oz8b1+GC 他のオブジェにアタッチしたスクリプトの変数をボタンを押して変更したいです。 Boolean(空オブジェ)にアタッチしているBoolean.cs の中の変数 bool BOOL を ボタンを押して、false から true にしたいです。 ヒエラルキーにあるオブジェ Canvas Button Boolean(空のオブジェにBoolean.csアタッチ) http://mevius.5ch.net/test/read.cgi/gamedev/1585478112/423
424: 423 [sage] 2020/05/12(火) 15:39:30.49 ID:oz8b1+GC //■■■Booleanに付けたスクリプト■■ using UnityEngine; public class Boolean : MonoBehaviour { public bool BOOL = false; void Update() {Debug.Log(BOOL);} } //■■■Buttonのクリックイベント■■ using UnityEngine; public class Button : MonoBehaviour { bool BOOL; public void Click()//ボタンのクリックイベント { BOOL = GameObject.Find("Boolean").GetComponent<Boolean>().BOOL; if (BOOL == false) {BOOL = true;} else {BOOL = false;} } } ボタンを押してもDebug.Log(BOOL) が true にならないです。 Booleanの中のboolean型の変数 を true にしたいのでどうか教えてください。 http://mevius.5ch.net/test/read.cgi/gamedev/1585478112/424
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.474s*