1. #pragma strict


  2. private var oneTexture : Texture2D;

  3. private var allTexture : Object[];


  4. function OnGUI(){

  5. if(GUI.Button(Rect(0,20,100,60),"Ainy")){

  6. if(oneTexture == null){

  7. oneTexture = Resources.Load("oneTexture/Grass");

  8. }

  9. }

  10. if(GUI.Button(Rect(0,140,100,60),"Aonaufly")){

  11. if(allTexture == null ){

  12. allTexture = Resources.LoadAll("allTextures");

  13. }

  14. }

  15. if(oneTexture != null){

  16. GUI.DrawTexture(Rect(110,20,120,120),oneTexture,ScaleMode.StretchToFill,true,0);

  17. }

  18. if(allTexture != null ){

  19. for(var i : int = 0 ; i < allTexture.Length; i += 1){

  20. GUI.DrawTexture(Rect(110+i*120,140,120,120),allTexture[i],ScaleMode.StretchToFill,true,0);


  21. }

  22. }

  23. }



  1. #pragma strict

  2. @script RequireComponent(AudioSource);


  3. function Start () {

  4. audio.loop = true;

  5. }

  6. function OnGUI(){

  7. if(GUILayout.Button("Play/Contine")){

  8. if(!audio.isPlaying){

  9. audio.Play();

  10. }

  11. }

  12. if(GUILayout.Button("Pause")){

  13. audio.Pause();

  14. }

  15. if(GUILayout.Button("Stop")){

  16. audio.Stop();

  17. }

  18. }