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 Sokaz Games · Dec 16, 2014 at 11:27 AM · c#android

Game temporarily freezes on android

In the beginning of my game, I have it set to fade to black and then load the next scene but, whenever I click, the game freezes for a small amount of time and then goes black completely without a proper transition. Now, I know the fade code is correct because it works perfectly fine running it inside unity.

Here is the code for the thing I was talking about:

 using UnityEngine;
 using System.Collections;
 
 public class Test : MonoBehaviour {
 
     public int level;
     public GUISkin skin;
 
     void Update()
     {
 
         if (Input.GetMouseButton(0)){
 
             gameObject.GetComponent<Fadeout>().enabled = true;
             Invoke("fade",0.5F);
 
         }
 
     }
 
     void fade()
     {
         Application.LoadLevel(level);
     }
 }
 

I've tried making my own timer, coroutines and involking but, all to the same fate. If you need anymore information to help me solve this issue, please ask.

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 Sokaz Games · Dec 17, 2014 at 05:17 AM 0
Share

I'm still looking for help on this one! Community, please don't fail me.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SkaredCreations · Dec 16, 2014 at 11:31 AM

You would really notice a fading that lasts for half second? You would be really a superman. I suggest you to have a public boolean variable in your Fadeout that is false by default and set it to true in your Fadeout code when the fade ends, finally change Invoke with InvokeRepeating in the code attached to this post and in the "fade" function you would call LoadLevel only if the above variable from Fadeout is true. Also you should enter the Input.GetButton statement only if the Fadeout component is not already enabled, else it could execute the same code more times if you click more than once.

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 Sokaz Games · Dec 16, 2014 at 12:18 PM 0
Share

The fade isn't half a second long, that is not how that works. The problem is that, it works fine on windows but, doesn't work very well on android and I'm looking for a fix.

avatar image SkaredCreations · Dec 17, 2014 at 09:16 AM 0
Share

I don't understand how IT can work in Any platform, looking at line 15 your Invoke is calling the function after half second.

avatar image Sokaz Games · Dec 18, 2014 at 01:33 AM 0
Share

Would you like the .apk so I can show you what I'm talking about?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Soft turn with joystick 0 Answers

How do I get Input.GetKeyDown(KeyCode.Escape) to register? 2 Answers

How can I use WebClient to download files on Android when behind a proxy? 1 Answer

Jittery movement of sprite on device 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