剪刀石頭布
using UnityEngine;using System.Collections;using UnityEngine.UI;public class NewBehaviourScript : MonoBehaviour { // Use this for initialization void Start () { }// Update is called once per frame void Update () { } public void myfun() { int num = Random.Range(1,4); Text mytxt = GameObject.Find ("Canvas/Panel/Text").GetComponent<Text> (); mytxt.text = num.ToString (); Image Imgy = GameObject.Find ("Canvas/Panel/Image").GetComponent<Image>(); Imgy.sprite=Resources.Load<Sprite>("Image/"+num) as Sprite; }}
10/6
沒有留言:
張貼留言