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 Kyoshiro_Mebu · Dec 31, 2014 at 06:31 AM · scriptingbasics

Can some one help me with splash screen?

I apologize for any inconvenience before hand because I am sure this question has been asked before, I just cannot find the answer. I am new to unity and been at it for about 2 months now. With help from tutorials I have gotten "use" to the engine itself. But my problem came from C# programming for I have no experience at all. 1st Scene in any video game is Logo Scene followed by a Title screen, so I made them both into scenes. 1.Logo and 2.StartScreen, now to connect them. I was thinking maybe a C# script connected to the main camera in the Logo Scene BUT I cannot connect. It reads:

    " Can't add component 'SplashScreenDelay' because it doesn't exist. Check to see if the file name and class name match. "

Now in the end I've tried I think 3 different scripts I've found online or in videos and all are the same result. I'm trying to get it to stay on the Logo Scene for 5sec then change to the Title Scene. This is the most recent code I've used:

 using UnityEngine;
 using System.Collections;
 
 public class SplashScreenDelay : MonoBehaviour {
     public float delayTime = 5;
 
 
 
     IEnumerator start() {
         yield return new WaitForSeconds( delayTime );
 
         Application.LoadLevel("2.StartScreen");
     }
 }


I've done a Clean and a Build in Mono and I have no errors for the script so I can't see the problem... Can any one please tell me what I am doing wrong?

Thx in advance for any assistance....

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Landern · Dec 31, 2014 at 06:33 AM

With c# scripts your class name must match the file name.

Using your example above. If the class is called SplashScreenDelay Then the file in your assets must be SplashScreenDelay and the file on disk must be SplashScreenDelay.cs, this applies specifically when deriving/inheriting from MonoBehaviour.

That is what "Can't add component 'SplashScreenDelay' because it doesn't exist. Check to see if the file name and class name match." is literally telling you.

Comment
Add comment · Show 1 · 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 gjf · Dec 31, 2014 at 03:09 PM 1
Share

and if you expect unity to automagically call your start() method then change it to Start()... they are not the same thing.

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

Where to Learn To Script 1 Answer

What are the Syntax Differences in C# and Javascript? 7 Answers

What is the difference between "prefix-casting" (Type)variable - and "as-casting" (variable as Type)? 2 Answers

Cant Find The Variable In Another Script? 1 Answer

Checking null variable error 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