#pragma strict
private var oneTexture : Texture2D;
private var allTexture : Object[];
function OnGUI(){
if(GUI.Button(Rect(0,20,100,60),"Ainy")){
if(oneTexture == null){
oneTexture = Resources.Load("oneTexture/Grass");
}
}
if(GUI.Button(Rect(0,140,100,60),"Aonaufly")){
if(allTexture == null ){
allTexture = Resources.LoadAll("allTextures");
}
}
if(oneTexture != null){
GUI.DrawTexture(Rect(110,20,120,120),oneTexture,ScaleMode.StretchToFill,true,0);
}
if(allTexture != null ){
for(var i : int = 0 ; i < allTexture.Length; i += 1){
GUI.DrawTexture(Rect(110+i*120,140,120,120),allTexture[i],ScaleMode.StretchToFill,true,0);
}
}
}
#pragma strict
@script RequireComponent(AudioSource);
function Start () {
audio.loop = true;
}
function OnGUI(){
if(GUILayout.Button("Play/Contine")){
if(!audio.isPlaying){
audio.Play();
}
}
if(GUILayout.Button("Pause")){
audio.Pause();
}
if(GUILayout.Button("Stop")){
audio.Stop();
}
}
转载于:https://blog.51cto.com/aonaufly/1273102