- 最后登录
- 2024-11-17
- 注册时间
- 2012-8-10
- 阅读权限
- 100
- 积分
- 74994
  
- 纳金币
- 59338
- 精华
- 28
|
随机获得图片的代码如下。
//--------------------------------------
using UnityEngine;
using System.Collections;
public class RandomTexture : MonoBehaviour
{
public Texture[] texList;
Texture GetRandomTex()
{
if (texList.Length > 0)
{
//参数为int的Random为左闭右开区间
int random = Random.Range(0, texList.Length);
return texList[random];
}
return null;
}
}
|
|