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 kurotatsu · Aug 22, 2013 at 11:36 PM · loadinglevelnotouya

after upgrading to Unity4.2 all levels work in editor, but not in Ouya correctly anymore?

Problem:

I have a project I'm developing for the Ouya, and it was loading fine in Unity 3.5, and exporting to the Ouya without any issues and playing fine.

I recently upgraded to Unity 4.2, and everything works in the Unity editor just fine, but my splash screen just goes black and never shows the image or loads the title screen like it used to.

I then took out the splash screen from the build settings and got my main menu to load directly, as the first scene, which switches fine to the profile screen.

Now in the profile screen when I hit my GUI button to load the first game scene(which works fine in the editor, but once again not in the Ouya), the screen goes black, and the game exits on the ouya back to the Ouya main menu.

I'll give you the entire code for the splash screen, and a code snippet for the load level portion of the profile screen to save bombarding code one ya.

Here's the code for the splash screen:

 //Kurotatsu Studios Splashscreen script, modified from Unity wiki.
 // SplashScreen Script
 
 
 var guiDepth : int = 0;
 var levelToLoad : String = "";
 var splashLogo : Texture2D;
 var fadeSpeed : float = 0.3;
 var waitTime : float = 0.5;
 var waitForInput : boolean = false;
 var startAutomatically : boolean = true;
 var timeFadingInFinished : float = 0.0;
 var logoPositioning : LogoPositioning;
 var splashType : SplashType;
 enum SplashType {LoadNextLevelThenFadeOut, FadeOutThenLoadNextLevel}
 enum LogoPositioning {Centered, Stretched}
 private var alpha : float = 0.0;
 private var status : FadeStatus = FadeStatus.FadeIn;
 private var oldCam : Camera;
 private var oldCamGO : GameObject;
 private var splashLogoPos : Rect;
 private var loadingNextLevel : boolean = false;
 private enum FadeStatus {Paused, FadeIn, FadeWaiting, FadeOut}
 
 
 function Start()
 {
     if (startAutomatically)
     {
         status = FadeStatus.FadeIn;
     }
 
     else
     {
         status = FadeStatus.Paused;
     }
 
     oldCam = Camera.main;
     oldCamGO = Camera.main.gameObject;
 
     if (logoPositioning == LogoPositioning.Centered)
     {
         splashLogoPos.x = (Screen.width * 0.5) - (splashLogo.width * 0.5);
         splashLogoPos.y = (Screen.height * 0.5) - (splashLogo.height * 0.5);
 
         splashLogoPos.width = splashLogo.width;
         splashLogoPos.height = splashLogo.height;
     }
 
     else
     {
         splashLogoPos.x = 0;
         splashLogoPos.y = 0;
 
         splashLogoPos.width = Screen.width;
         splashLogoPos.height = Screen.height;
     }
 
     if (splashType == SplashType.LoadNextLevelThenFadeOut)
     {
         DontDestroyOnLoad(this);
         DontDestroyOnLoad(Camera.main);
     }
 
 
     if ((Application.levelCount <= 1) || (levelToLoad == ""))
     {
         Debug.LogWarning("Invalid levelToLoad value.");
     }
 }
 
 
 
 function Update()
 {
     switch(status)
     {
         case FadeStatus.FadeIn:
             alpha += fadeSpeed * Time.deltaTime;
         break;
 
         case FadeStatus.FadeWaiting:
             if ((!waitForInput && Time.time >= timeFadingInFinished + waitTime) || (waitForInput && Input.anyKey))
             {
                 status = FadeStatus.FadeOut;
             }
         break;
 
         case FadeStatus.FadeOut:
             alpha += -fadeSpeed * Time.deltaTime;
         break;
     }
 }
 
 
 
 function OnGUI()
 {
     GUI.depth = guiDepth;
 
     if (splashLogo != null)
     {
         GUI.color = Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
         GUI.DrawTexture(splashLogoPos, splashLogo);
 
             if (alpha > 1.0)
             {
                 status = FadeStatus.FadeWaiting;
                 timeFadingInFinished = Time.time;
                 alpha = 1.0;
 
                 if (splashType == SplashType.LoadNextLevelThenFadeOut)
                 {
                     oldCam.depth = -1000;
                     loadingNextLevel = true;
 
                     if ((Application.levelCount >= 1) && (levelToLoad != ""))
                     {
                         Application.LoadLevel(levelToLoad);
                     }
                 }
             }
 
             if (alpha < 0.0)
             {
                 if (splashType == SplashType.FadeOutThenLoadNextLevel)
                 {
                     if ((Application.levelCount >= 1) && (levelToLoad != ""))
                     {
                         Application.LoadLevel(levelToLoad);
                     }
                 }
 
                 else
                 {
                     Destroy(oldCamGO);
                 }
             }
     }
 }
 
 
 
 function OnLevelWasLoaded(lvlIdx : int)
 {
     if (loadingNextLevel)
     {
         Destroy(oldCam);
     }
 }
 
 
 function OnDrawGizmos()
 {
     Gizmos.color = Color(1, 0, 0, 0.5);
     Gizmos.DrawCube(transform.position, Vector3(1, 1, 1));
 }
 
 
 function StartSplash()
 {
     status = FadeStatus.FadeIn;
 }

and here's from the Profile screen:

 if(GUI.Button(Rect(5,Screen.height -100,200,50), "Start Game.")){
  
 if (profile == 1){
     Profile1();
 5. 
     }
 if (profile == 2){
     Profile2();
  
 10.    }
 if (profile == 3){
     Profile3();
  
     }       
 
 
 }
 
 function Profile1(){
 PlayerPrefs.SetInt("profile", 1);
 Application.LoadLevel(levelToLoad);
 }
 
 

I don't see anything that could be causing it, which is why I'm asking.

Thanks for your time.

Kuro.

Comment
Add comment · Show 4
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 meat5000 ♦ · Aug 22, 2013 at 11:45 PM 0
Share

I think its a Unity 4.2 problem. Try playing with Depth buffers. But for what its worth, my problem like this went away after I SWITCHED PLATFOR$$anonymous$$ AND BAC$$anonymous$$ AGAIN Weird eh?

avatar image kurotatsu · Aug 22, 2013 at 11:53 PM 0
Share

Wow, I'll try that. First the depth buffers idea(haveta do some googling.:D), then the switching platforms.

I'll post back if it works. Thanks meat5000.

avatar image meat5000 ♦ · Aug 23, 2013 at 12:06 AM 0
Share

Lots of people reporting the same problems. Some get fixed this way, some don't.

GOOD LUC$$anonymous$$ DUDE!!

avatar image kurotatsu · Aug 23, 2013 at 05:41 AM 0
Share

No luck, same problem after I switched platforms.

If anyone is aware of other people having this problem and talking about it, please post a link here.

I'd sure hate to revert back to 3.5 unnecessarily.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by BigToe · Aug 24, 2013 at 07:55 PM

I was having difficulty with 4.2 and what I believe is the same problem. I had a preloader scene with a splash graphic...It loaded my main menu screen which had a matching logo that would fade out...

With 4.2 there was a black flicker between the preloader screen and the main menu screen. If I reduced scripts it was a second, if I had all my init scripts in it took close to 3 or 4 seconds of black....Switching platforms didn't work.

My solution was to create a duplicate preloader scene to pass through before the main menu scene.

So I have preloader1 -> preloader2 -> main menu

Hope this might help you.

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

17 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

Related Questions

Game crashes or does not load levels when told to? 2 Answers

Level Not Loading After Screen Fade 1 Answer

Level Loading By 3D Text 1 Answer

Loading Screen? 6 Answers

JavaScript Level Loading Disable A Layer 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