• 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 bobolat · Oct 19, 2014 at 02:25 PM · texturespheremovietexture

[SOLVED]my original texture change to movie texture

hello everyone..here's my case..ill provide some picture what actually happen to my project..first picture show my original texture of sphere..when i click the object it will show guibox that show movie texture there(picture 2)..after i play and stop it show my sphere like in picture 2 beside my pop guibox.. here my my code so far..everything fine except the material changed after i play the video..help me plzz

picture 1 : alt text

picture 2 : alt text

 using UnityEngine;
 using System.Collections;
 
 public class eq1 : MonoBehaviour {
     
     // Use this for initialization
     private bool PopUp;
     public string Info;
     public MovieTexture movie_eq1;
 
     void OnMouseDown()
     {
         PopUp = true;
 
     }
     
     void DrawInfo()
     {
         //Rect rect = new Rect (20,20, 600, 400);
         Rect close = new Rect (800,20,20,20);
         Rect play = new Rect (100, 360, 50, 25);
         Rect pause = new Rect (150, 360, 50, 25);
         Rect stop = new Rect (200, 360, 50, 25);
 
             
         if (PopUp)
         {
             //content
             GUI.Box(new Rect(20, 20, 800, 400), "Weigh Machine");
             //GUI.Box(rect, Info);
             GUI.DrawTexture(new Rect(30, 50, 400, 300), movie_eq1);
 
 
 
 
             //playbutton
             if (GUI.Button(play,"play"))
             {
                 //Debug.Log("playvideo");
                 renderer.material.mainTexture = movie_eq1;
                 movie_eq1.Play();
             }
             //pause
             if (GUI.Button(pause,"pause"))
             {
                 renderer.material.mainTexture = movie_eq1;
                 movie_eq1.Pause();
             }
             //stopbutton
             if (GUI.Button(stop,"stop"))
             {
 
                 movie_eq1.Stop();
             }
             //guiTexture.texture.Play();
             if (GUI.Button(close,"X"))
             {
                 PopUp = false;
                 movie_eq1.Stop();
                 //Debug.Log("close");
             }
         }
     }
 
 
     void OnGUI()
     {
         DrawInfo();
 
     }
 }


2.jpg (133.4 kB)
1.jpg (18.4 kB)
Comment
Add comment · Show 1
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 bobolat · Oct 20, 2014 at 06:07 AM 0
Share

help me plzz

1 Reply

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

Answer by Phantomized · Oct 20, 2014 at 07:34 AM

I'm not completely clear on what you are asking. You don't want the texture of the sphere to change at all? then at:

  if (GUI.Button(play,"play"))
              {
                  //Debug.Log("playvideo");
                renderer.material.mainTexture = movie_eq1;
                  movie_eq1.Play();
              }
              //pause
              if (GUI.Button(pause,"pause"))
            {
                  renderer.material.mainTexture = movie_eq1;
                  movie_eq1.Pause();
              }

Remove the 2 "renderer.material.mainTexture = movie_eq1;" as they are giving your sphere the movie texture.

If you want the texture to be on the sphere, but return to your original texture on close:

 private Texture origTexture;

 void Start () {
     origTexture = renderer.material.mainTexture;
 }

...and then further down in your close button:

         if (GUI.Button(close,"X"))
         {
             PopUp = false;
             movie_eq1.Stop();
             renderer.material.mainTexture = origTexture;
         }


So it basically saves the original texture, and gives it back to the sphere when you close the movie.

Comment
Add comment · Show 3 · 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 bobolat · Oct 20, 2014 at 09:08 AM 0
Share

thnks man..i love u..haha..i just don't want the texture of the sphere to change to movie texture at all..so i just delete render code as u mention above..it work..hehe.. SOLVED

avatar image Baste · Oct 20, 2014 at 10:44 AM 0
Share

Can you mark the correct answer as a solution? Then it won't show up in the unanswered queue anymore.

avatar image bobolat · Oct 20, 2014 at 06:24 PM 0
Share

done..thnks..sorry im newbie here..

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Texturing a icosphere 0 Answers

Assigning UV Map to model at runtime 0 Answers

Animated GIF as a texture on Iphone 3 Answers

Movie Texture not updating 0 Answers

Plotting stars on dynamic sphere texture 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