In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The Theora Converter .NET converter converts other formats to ogv format, which is directly recognized by unity, no need to install quicktime, no reboot, and more importantly, it is clearer than importing mov into unity.
[csharp] view plaincopy
1. Using UnityEngine
2. Using System.Collections
3.
4. Public class MovieTest: MonoBehaviour
5. {
6. / / Movie texture
7. Public MovieTexture movTexture
8.
9. Void Start ()
10. {
11. / / sets the main texture of the current object to be a movie texture
12. Renderer.material.mainTexture = movTexture
13. / / set the movie texture playback mode to loop
14. MovTexture.loop = true
15. / / StartCoroutine (DownLoadMovie ())
16.}
17.
18. Void OnGUI ()
19. {
20. If (GUILayout.Button ("play / continue")
21. {
twenty-two。 / / play / continue to play the video
23. If (! movTexture.isPlaying)
24. {
25. MovTexture.Play ()
twenty-six。 }
twenty-seven。 }
twenty-eight。
twenty-nine。 If (GUILayout.Button (pause playback))
thirty。 {
thirty-one。 / / pause playback
thirty-two。 MovTexture.Pause ()
thirty-three。 }
thirty-four。
thirty-five。 If (GUILayout.Button ("stop playing"))
thirty-six。 {
thirty-seven。 / / stop playback
thirty-eight。 MovTexture.Stop ()
thirty-nine。 }
forty。 }
forty-one。
forty-two。 IEnumerator DownLoadMovie ()
forty-three。 {
forty-four。 WWW www = new WWW ("http://127.0.0.1/Head.ogv");
forty-five。 Yield return www
forty-six。 Debug.Log (Time.time)
forty-seven。 MovTexture = www.movie
forty-eight。 / / sets the main texture of the current object to be a movie texture
forty-nine。 Renderer.material.mainTexture = movTexture
fifty。 MovTexture.loop = true
fifty-one。 }
fifty-two。
fifty-three。 }
Add sound
[csharp] view plaincopy
1. Using UnityEngine
2. Using System.Collections
3.
4. Public class MovieTest: MonoBehaviour
5. {
6. / / Movie texture
7. Public MovieTexture movTexture
8. / / sound
9. Public AudioSource movAudio
10.
11. Void Start ()
12. {
13. / / sets the main texture of the current object to be a movie texture
14. Renderer.material.mainTexture = movTexture
15. / / set the movie texture playback mode to loop
16. MovTexture.loop = true
17. / / StartCoroutine (DownLoadMovie ())
18.}
19.
20. Void OnGUI ()
21. {
twenty-two。 If (GUILayout.Button ("play / continue")
23. {
24. / / play / continue to play the video
25. If (! movTexture.isPlaying)
twenty-six。 {
twenty-seven。 MovTexture.Play ()
twenty-eight。 MovAudio.Play ()
twenty-nine。 }
thirty。 }
thirty-one。
thirty-two。 If (GUILayout.Button (pause playback))
thirty-three。 {
thirty-four。 / / pause playback
thirty-five。 MovTexture.Pause ()
thirty-six。 MovAudio.Pause ()
thirty-seven。 }
thirty-eight。
thirty-nine。 If (GUILayout.Button ("stop playing"))
forty。 {
forty-one。 / / stop playback
forty-two。 MovTexture.Stop ()
forty-three。 MovAudio.Stop ()
forty-four。 }
forty-five。 }
forty-six。
forty-seven。 IEnumerator DownLoadMovie ()
forty-eight。 {
forty-nine。 WWW www = new WWW ("http://127.0.0.1/Head.ogv");
fifty。 Yield return www
fifty-one。 Debug.Log (Time.time)
fifty-two。 MovTexture = www.movie
fifty-three。 / / sets the main texture of the current object to be a movie texture
fifty-four。 Renderer.material.mainTexture = movTexture
fifty-five。 MovTexture.loop = true
fifty-six。 }
fifty-seven。
fifty-eight。 }
Note: videos with 1280 to 720 resolution will not produce black edges when played in this way.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.