###前提・実現したいこと
ボタンをクリックしてgameObjectの表示、非表示を切り替えるプログラムを作成しているのですが発生したエラーに対する対処法がいまいち分かりません。
###発生している問題・エラーメッセージ
Assets/kirikae.cs(11,19): error CS0029: Cannnot implicitly convert type 'void' to 'bool'
###該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; public class kirikae : MonoBehaviour { public void Onclick() { { if (gameObject.SetActive(true)) gameObject.SetActive (false); } if (gameObject.SetActive(false)) gameObject.SetActive (true); } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/14 22:12
2018/01/14 22:37
2018/01/14 23:32