SalonScreenAutoPlay.cs 695 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using UnityEngine;
  3. public class SalonScreenAutoPlay : MonoBehaviour
  4. {
  5. public void Awake()
  6. {
  7. if (this.TargetObject != null)
  8. {
  9. Renderer component = this.TargetObject.GetComponent<Renderer>();
  10. if (component != null && component.material != null)
  11. {
  12. this.movie_tex_ = (component.material.mainTexture as MovieTexture);
  13. }
  14. }
  15. else
  16. {
  17. this.movie_tex_ = (base.GetComponent<Renderer>().material.mainTexture as MovieTexture);
  18. }
  19. }
  20. public void Start()
  21. {
  22. if (this.movie_tex_ != null && !this.movie_tex_.isPlaying)
  23. {
  24. this.movie_tex_.loop = true;
  25. this.movie_tex_.Play();
  26. }
  27. }
  28. public GameObject TargetObject;
  29. private MovieTexture movie_tex_;
  30. }