• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Kay3D · Mar 29, 2011 at 05:04 PM · movietexture

Movie Texture will not play!

Hello!

I have this code attached to a cube with a gui texture. But it will not play! Any suggestions to what I have done wrong? Any help would be greatly appreciated.

var wwwData : WWW; var url : String = "http://dl.dropbox.com/u/23413053/walkcyclemesh.mov";

 function Start () {
 wwwData = new WWW (url);
 guiTexture.texture = wwwData.movie;
 }

 function Update () {
 var m : MovieTexture = guiTexture.texture as MovieTexture;
 if (!m.isPlaying && m.isReadyToPlay)
 m.Play ();

 if(!m.isReadyToPlay){
     GUI.Label (Rect (410, 605, 100, 20), "Loading");

     }

 }

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Justin Warner · Mar 29, 2011 at 05:11 PM 0
Share

You got Unity pro? Also, you should add a yield in there and then have a Debug.Log("TEST"); to make sure it downloaded the whole thing... It might be downloading still or what not...

avatar image Kay3D · Mar 29, 2011 at 05:15 PM 0
Share

I have the unity pro trial. I took this code straight from the Unity Scripting Reference. I also have this in a web player so I cannot see the log that is why i threw in a guiLabel to let me know it was loading. Ill throw a yield and see how i get on! Thanks a mill

avatar image Justin Warner · Mar 29, 2011 at 05:20 PM 0
Share

You can always test it in the editor... Our you could output it to a GUI label as well... But okay

avatar image Kay3D · Mar 29, 2011 at 05:22 PM 0
Share

Really? I didnt think the www object would download in the editor! thank you !

avatar image Justin Warner · Mar 29, 2011 at 05:23 PM 0
Share

I'm pretty sure it would, I'd try it their first at least. $$anonymous$$aybe a small video too, just to see if it'll work first in general.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Justin Warner · Mar 29, 2011 at 09:17 PM

http://unity3d.com/support/documentation/Manual/Video%20Files.html

http://unity3d.com/support/documentation/ScriptReference/WWW-movie.html

You have those two links...
Here's the code for what I'd personally use:

var url = "http://www.unity3d.com/webplayers/Movie/sample.ogg"; function Start () { // Start download var www = new WWW(url);

 // Make sure the movie is ready to start before we start playing
 var movieTexture = www.movie;
 while (!movieTexture.isReadyToPlay)
     yield;


 // Initialize gui texture to be 1:1 resolution centered on screen
 guiTexture.texture = movieTexture;

 transform.localScale = Vector3 (0,0,0);
 transform.position = Vector3 (0.5,0.5,0);
 guiTexture.pixelInset.xMin = -movieTexture.width / 2;
 guiTexture.pixelInset.xMax = movieTexture.width / 2;
 guiTexture.pixelInset.yMin = -movieTexture.height / 2;
 guiTexture.pixelInset.yMax = movieTexture.height / 2;

 // Assign clip to audio source
 // Sync playback with audio
 audio.clip = movieTexture.audioClip;

 // Play both movie & sound
 movieTexture.Play();
 audio.Play();

} // Make sure we have gui texture and audio source @script RequireComponent (GUITexture) @script RequireComponent (AudioSource)

Obviously the url will change. I'd put this script on the texture, yes, as it does say this returns a texture, so I'd assume that it'd return the movie to the new texture... Comment back if you need more help though.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kay3D · Mar 30, 2011 at 09:35 AM 0
Share

Justin Warner you are my hero! You are definitely getting a mention in my project report acknowledgment. Thank you so much for your time and effort I really appreciate it.

avatar image Justin Warner · Mar 30, 2011 at 11:34 AM 0
Share

Glad it worked, and thanks. =).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

is there a good way to make a transparent video in unity ? 3 Answers

www.movie not playing? 1 Answer

Image Sequence in unity without using .gifs for a crowd 2 Answers

using WWW to load ogv onto MovieTexture (winStore) 0 Answers

how i can have "Movie Texture"s on my Android games ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges