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 Alyens Studios · Jul 03, 2015 at 10:40 PM · c#errorstringconverttostring

Convert Int to String?

i wanna make a function that when i click a button set active the next canvas and inactive the current canvas, if just was one of two could be easy but are at least 50....

i try make a var that represent the number of the canvas in the scene and star in 0, so when i press a button the var++ and represent the next scene...and not have to make a lot of functions inactive and active canvas

 int nextScene = 0;
 public Canvas Canvas1
 
 
 public void NextFunction ()
     {
           nextScene++;
           nextScene.toString();
           Canvas("nextScene").enabled=false;
     }

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 komodor · Jul 03, 2015 at 10:43 PM 0
Share

make array of canvases and call them by index in that array

avatar image W.Walter · Jul 04, 2015 at 02:17 AM 0
Share

I can't see what int-string conversion has to do with the actual issue. It seems like your trying to do this in a non-optimal way.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by W.Walter · Jul 04, 2015 at 02:16 AM

The idea is to store all the canvases in an array, so you can access them by index. Then, when you want to go to the next one; inactive the current one, increment the index, and activate the canvas at the new index.

  int current_scene = 0;
  public Canvas[] canvases; // Array of canvases, accessed by index
  
  
  public void NextFunction ()
      {
            // Before incrementing the current_scene value, inactivate the last canvas
            canvases[current_scene].enabled = false;
            // Note; this will eventually create an IndexOutOfBounds error
            current_scene++;
            canvases[current_scene].enabled = true;
      }
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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Cannot implicitly convert type string to list - Why is this? 1 Answer

Distribute terrain in zones 3 Answers

Converting a string to an int 2 Answers

Particle circle HELP 1 Answer

Convert string to guitext, in a guitext array. 0 Answers


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