Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 SunilPandey__ · Oct 05, 2013 at 07:54 AM · texturebuttonscene

Switching scene problem

`I have created many scenes. two scenes named "GameOver" and "ScreenSetting". in these scenes i have made some texture with script. problem is that when i play this scene then it shows all the textures of scene but when i switch to other scene and come back to these two scene and play then no texture is displayed. whts the problem? sample code is here

 function OnGUI() {
     if(!soundTexture){
             Debug.LogError("Assign a Sound Texture in the inspector.");
             return;
         }
         GUI.DrawTexture(Rect((Screen.width*20)/100,(Screen.height*15)/100,(Screen.width*38)/100,(Screen.height*20)/100), soundTexture);
     if(!vibrateTexture){
             Debug.LogError("Assign a vibrate Texture in the inspector.");
             return;
         }
         GUI.DrawTexture(Rect((Screen.width*21)/100,(Screen.height*43)/100,(Screen.width*38)/100,(Screen.height*20)/100), vibrateTexture);
             
         if(!fastTexture){
             Debug.LogError("Assign a fast Texture in the inspector.");
             return;
         }
         GUI.DrawTexture(Rect((Screen.width*20)/100,(Screen.height*70)/100,(Screen.width*38)/100,(Screen.height*20)/100), fastTexture);
         
         if (GUI.Button(Rect((Screen.width*5)/100,(Screen.height*80)/100,(Screen.width*20)/100,(Screen.height*20)/100),back,testStyle)){
                 Application.LoadLevel("StartScene");
                 Handheld.Vibrate();
                 
             
             }
      }

`

these are the texture which i have defined in setting Scene, when I assign all the texture and play first time then it shows all the texture but when i switch to other scene and come back to setting scene then no texture appears when i play

Comment
Add comment · Show 2
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 mattssonon · Oct 05, 2013 at 08:57 AM 0
Share

We don't have enough information to help you, we need to see some code at least.

avatar image SunilPandey__ · Oct 05, 2013 at 09:12 AM 0
Share

@mattssonon now see my question

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TrickyHandz · Oct 05, 2013 at 02:47 PM

If you are trying to maintain information assigned to varibles across a scenes you either need to call DontDestroyOnLoad() or use Static variables to store the information.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GUI Button is not responding click event 1 Answer

Programming a texture to act as a button... 1 Answer

How do you auto scale the space between Gui Buttons? 1 Answer

Changing a button texture in Selection Grid 1 Answer

Changing scene with button android 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