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 Vitruvius · Aug 22, 2010 at 10:20 PM · fpsiphoneloadlevelbce0005

Fade to white after being killed - iPhone game

I'm using the following bit of code from the FPS script tutorial fade to white after death.

LevelLoadFade.FadeAndLoadLevel(Application.loadedLevel, Color.white, 2.0);

However I get an error message in the console:

Assets/myGame/Scripts/health.js(35,9): BCE0005: Unknown identifier: 'LevelLoadFade'.

Does LevelLoadFade not work for Unity iPhone? Can someone confirm this?

And if it doesn't can someone tell me what I need for Unity iPhone to get the Fade to white effect.

Thanks,

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by · Aug 23, 2010 at 01:54 AM

That error would indicate to me that the method hasn't been declared. LevelLoadFade isn't a native function in Unity - it's probably part of the FPS Tutorial.

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 Vitruvius · Aug 23, 2010 at 02:13 AM 0
Share

I took the LevelLoadFade script from the FPS tutorial and added it to my assets then used that bit of code in another script. But comes up with even more similar errors.

Can someone confirm if this is not used for Unity iPhone?

avatar image · Aug 23, 2010 at 02:18 AM 0
Share

Take a look at http://answers.unity3d.com/questions/1375/errors-in-fps-tutorial - are they the same errors? The answer indicates that it may not work on iPhone at all.

avatar image Vitruvius · Aug 23, 2010 at 12:17 PM 0
Share

thanks for the link and your help. Does anyone know a workaround to get it to work on Unity iPhone?

avatar image
0

Answer by jtbentley · Aug 29, 2010 at 02:18 AM

Here's a script from one of the wiki's... I trigger it to fade a loading screen in, I wait for that to finish, then I trigger the Application.LoadLevel (which has the same image on the other side but fades out).

// FadeInOut // //-------------------------------------------------------------------- // Public parameters //--------------------------------------------------------------------

public var fadeOutTexture : Texture2D; public var fadeSpeed = 0.3;

var drawDepth = -1000;

//-------------------------------------------------------------------- // Private variables //--------------------------------------------------------------------

private var alpha = 1.0;

private var fadeDir = -1;

//-------------------------------------------------------------------- // Runtime functions //--------------------------------------------------------------------

//--------------------------------------------------------------------

function OnGUI(){

 alpha += fadeDir * fadeSpeed * Time.deltaTime;  
 alpha = Mathf.Clamp01(alpha);   

 GUI.color.a = alpha;

 GUI.depth = drawDepth;

 GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeOutTexture);
 if (alpha<0.01) {
 Destroy(gameObject,0);  
 }

}

//--------------------------------------------------------------------

function fadeIn(){ fadeDir = -1;
}

//--------------------------------------------------------------------

function fadeOut(){ fadeDir = 1;
}

function Start(){ alpha=1; fadeIn();

}

Comment
Add comment · Show 2 · 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 Vitruvius · Aug 29, 2010 at 12:32 PM 0
Share

JT, Thanks it works very well. However there is one slight issue.

In the console I get the following message:

"There are no audio listeners in the scene. Please ensure there is always one audio listener in the scene"

There is an audio listener in the scene and it is checked in the inspector, in fact it is on the same $$anonymous$$ain Camera I attached the script to.

avatar image ExplodingCookie · Jul 07, 2013 at 10:09 PM 0
Share

Does some other script deactivate the camera or the AudioListener component? If at any point either of those are disabled, even for a single frame, that error will show up.

~ExplodingCookie

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

1 Person is following this question.

avatar image

Related Questions

Level advancment Scirpt 1 Answer

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

Other scenes influencing performance ? 2 Answers

Hunger system help - Money to be made 0 Answers

How to implement an ammo counter using textured quads? [Scripting doubts] 2 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