Unityで絵合わせを作っているのですが、クリックして絵を表示する方法が分かりません。
このコードで書くと、ペアになるカードの方も一緒にめくれてしまい、ゲームとして成立しません。
どうすればいいでしょうか
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class hannnari1 : MonoBehaviour { 6 7 public Texture tex; 8 public Renderer rnd; 9 public GameObject obj; 10 // Use this for initialization 11 void Start () { 12 //textureの呼び出し 13 tex = Resources.Load ("Texture/hannnari 1") as Texture; 14 //この二行でデータの同期が完了する. 15 obj = GameObject.Find ("Cube 10"); 16 rnd = obj.GetComponent<Renderer> (); 17 } 18 19 // Update is called once per frame 20 void Update () { 21 if (Input.GetMouseButtonDown (0)) { 22 //対象のオブジェクトのテクスチャの変更 23 rnd.material.mainTexture = tex; 24 } 25 } 26} 27
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/16 06:17
2018/06/16 06:42 編集
2018/06/16 23:31