Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Ajaxx84 · Aug 27, 2011 at 10:50 PM · playerfpsbce0005

Question about FPS Player Script

I have taken the FPS Player script from the FPS tutorial and have edited it to suit my needs but I am getting the following error message :

Assets/Scripts/FPSPlayer.js(62,5): BCE0005: Unknown identifier: 'LevelLoadFade'.

The script (after editing) is :

 var maximumHitPoints = 100.0;
 var hitPoints = 100.0;
 
 var healthGUI : GUITexture;
 
 var walkSounds : AudioClip[];
 var painLittle : AudioClip;
 var painBig : AudioClip;
 var die : AudioClip;
 var audioStepLength = 0.3;
 
 private var healthGUIWidth = 0.0;
 private var gotHitTimer = -1.0;
 
 function Awake () {
     
     PlayStepSounds();
 
     healthGUIWidth = healthGUI.pixelInset.width;
 }
 
 function ApplyDamage (damage : float) {
     if (hitPoints < 0.0)
         return;
 
     // Apply damage
     hitPoints -= damage;
 
     // Play pain sound when getting hit - but don't play so often
     if (Time.time > gotHitTimer && painBig && painLittle) {
         // Play a big pain sound
         if (hitPoints < maximumHitPoints * 0.2 || damage > 20) {
             audio.PlayOneShot(painBig, 1.0 / audio.volume);
             gotHitTimer = Time.time + Random.Range(painBig.length * 2, painBig.length * 3);
         } else {
             // Play a small pain sound
             audio.PlayOneShot(painLittle, 1.0 / audio.volume);
             gotHitTimer = Time.time + Random.Range(painLittle.length * 2, painLittle.length * 3);
         }
     }
 
     // Are we dead?
     if (hitPoints < 0.0)
         Die();
 }
 
 function Die () {
     if (die)
         AudioSource.PlayClipAtPoint(die, transform.position);
     
     // Disable all script behaviours (Essentially deactivating player control)
     var coms : Component[] = GetComponentsInChildren(MonoBehaviour);
     for (var b in coms) {
         var p : MonoBehaviour = b as MonoBehaviour;
         if (p)
             p.enabled = false;
     }
 
     LevelLoadFade.FadeAndLoadLevel(Application.loadedLevel, Color.white, 2.0);
 }
 
 function LateUpdate () {
     // Update gui every frame
     // We do this in late update to make sure machine guns etc. were already executed
     UpdateGUI();
 }
 
 function PlayStepSounds () {
     var controller : CharacterController = GetComponent(CharacterController);
 
     while (true) {
         if (controller.isGrounded && controller.velocity.magnitude > 0.3) {
             audio.clip = walkSounds[Random.Range(0, walkSounds.length)];
             audio.Play();
             yield WaitForSeconds(audioStepLength);
         } else {
             yield;
         }
     }
 }
 
 
 function UpdateGUI () {
     // Update health gui
     // The health gui is rendered using a overlay texture which is scaled down based on health
     // - Calculate fraction of how much health we have left (0...1)
     var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
 
     // - Adjust maximum pixel inset based on it
     healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;
 
     }

I am not sure what is causing this to be unknown as I have not deleted anything that did not pertain specifically to the machine gun or rocket launch that is given to you in the tutorial.. Any ideas as to why this script is bugging out?

Thanks in advance.

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
Best Answer

Answer by aldonaletto · Aug 28, 2011 at 01:58 PM

Unity is complaining that it doesn't know the LevelLoadFade name. This name refers to the script LevelLoadFade.js, which is missing in your project. You must copy this script to your Assets folder - or add it using the Assets/Import New Asset... menu option.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Where is the FPSPlayer Script? 0 Answers

Player moves faster when fps is higher? 1 Answer

How to run a script to only 1 player in a multiplayer fps 1 Answer

a strange problem ? 1 Answer

Line Renderer Collision Detection. 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