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 montedapaz · Apr 01, 2014 at 05:21 AM · uiloadlevelinput.touchtk2d

Code behaving differently after LoadLevel()

I've tried searching, but can't find a solution.

I'm having an issue that I can't pin down. When I run my scene in the Editor, my code functions great, but when I load the scene from a different scene this code isn't working proper.

I'm using TK2D's UI buttons as touch controls for the game and this function is supposed to be called when I release the "firing" button to make sure I don't get an out of bounds exception with my other touches. If the fingerID of the other touches is greater than the one released it will lower the ID of the other touches. Again, this seems to work great when I build the scene by itself, but when it's being loaded this function stops working.

I'm definitely a noob to programming and even more so to Unity, so maybe i'm just going about this all the wrong way. But here's the code:

 void FireUp ()
         {
                 RecalcTouch (fireFinger);
                 fireFinger = -32; //this is the null state
         }
 
 void RecalcTouch (int released)
         {
                 if (dPadFinger > released) {
                         Debug.Log ("dPadFinger (" + dPadFinger + ") > released (" + released + ")");
                         dPadFinger--;
                 }
                         
                 if (sPadFinger > released)
                         sPadFinger--;
 
         }

Hopefully I wrote this question and stuff right. It's my first. Thanks for the help...

It doesn't seem like it, but maybe this is just a tk2d problem...

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 getyour411 · Apr 01, 2014 at 05:25 AM 0
Share

I see nothing here to account for this. When you load from the other scene, are there prefabs, instantiated "master" objects (like Game$$anonymous$$aster, Player, etc) that have DontDestroyOnLoad attached (or static vars) that might be causing conflicts?

avatar image montedapaz · Apr 01, 2014 at 01:59 PM 0
Share

Hey thanks for the reply... I was waiting for my question to be approved so I could post the answer.

This was entirely a T$$anonymous$$2D thing. For anyone out there who isn't familiar with T$$anonymous$$2D, they have a UI$$anonymous$$anager prefab that doesn't get destroyed in LoadLevel. Also, in the newer versions of T$$anonymous$$2D you don't absolutely need the UI$$anonymous$$anager. Their UICamera prefab will substitute this.

What was happening was that the UICamera in the first scene was getting selected as the UI$$anonymous$$anager and was deleting my $$anonymous$$anager in my second scene. Hence, I wasn't getting any errors, but I was losing some of my settings.

So, all I did was cut my manager from my second scene and paste it in the first. So... thanks again... you're exactly right, T$$anonymous$$2d's UI $$anonymous$$anager acts as a "master" object. Cheers.

0 Replies

· Add your reply
  • Sort: 

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

20 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 avatar image avatar image

Related Questions

Levels changing with UI best practice 2 Answers

Clear presses from previous scene 4 Answers

Input registering random touches 1 Answer

UI cycling through my level select levels 1 Answer

scene loads properly when i load it manually but doesnt load properly when loading from other scene(using application,loadlevel ,also tried scenemanager). 3 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