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 ccwiegreff · Mar 13, 2013 at 11:54 PM · error

What does this error mean?

everything works except for the sounds and it still lets me play without um,the error is: IndexOutOfRangeException: Array index is out of range. Footsteps+$FootStepsSound$85+$.MoveNext () (at Assets/OG_Scripts/HUD Classes/Footsteps.js:14)

For this script:

var footAudio: AudioClip[]; var controller: CharacterController;

private var Run: Run = null;

function Awake(){ FootStepsSound(); }

function FootStepsSound(){ while(true){ if (controller.isGrounded && controller.velocity.magnitude > 3){ var volume = Mathf.Clamp01(Time.time); controller.audio.PlayOneShot(footAudio[Run.stepSound], volume); yield WaitForSeconds(Run.audioStepLength); } else { yield; } } }

I don't know what the error wants me to change, help would be appreciated

Comment
Add comment · Show 2
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 Benproductions1 · Mar 14, 2013 at 12:11 AM 1
Share

Please format your code! Noone can read unformatted code!!!

avatar image ccwiegreff · Mar 14, 2013 at 12:32 AM 0
Share

I sent a thank you comment a few $$anonymous$$utes ago, what you said helped, there were missing audioclips, I only put 2 there were supposed to be 5, Thanks XP

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Benproductions1 · Mar 14, 2013 at 12:15 AM

Index out of range exception, means that you are trying to access something in a list of some sort that doesn't exit at that index.

probably controller.audo.PlayOneShot(footAudio[Run.stepSound], volume) is trying to access footAudio[Run.stepSound] does not exist , but it's hard to tell, since you don't format your code!!!

Hope this helps, Benproductions1

Comment
Add comment · Show 5 · 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 ccwiegreff · Mar 14, 2013 at 12:19 AM 0
Share

yeah,thats where the error took me but I didn't know what to do , I did set audioclips but anyway thanks for making this make a bit more sense

avatar image Benproductions1 · Mar 14, 2013 at 12:20 AM 0
Share

have you tried going foorAudio[0] ?

avatar image ccwiegreff · Mar 14, 2013 at 12:22 AM 0
Share

never$$anonymous$$d, thanks, what you said helped, I justed needed to add a few more clips, I had 2 it needed 5, Thanks XP

avatar image Benproductions1 · Mar 14, 2013 at 12:32 AM 0
Share

If I answered your question, please accept it as the answer, by clicking the little tick under the thumbs down button :)

Or close the question if you want

avatar image Benproductions1 · Mar 14, 2013 at 12:38 AM 0
Share

Thank you :D

avatar image
1

Answer by whebert · Mar 14, 2013 at 12:27 AM

The offending piece of code that appears to be causing this exception is the following:

 footAudio[Run.stepSound]

It means that your Run.stepSound value, at the moment of the error, is higher than the amount of audio clips you have in your footAudio array. For instance, if you have 4 audio clips in the footAudio array, and your Run.stepSound is set to 4 or higher (should be between 0 and 3), you will get the IndexOutOfRangeException.

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

12 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

Related Questions

Multiple Cars not working 1 Answer

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

UCE0001 error Insert a Semicolon at end 1 Answer

Expressions in statements must only be executed for their side-effects. 1 Answer

Inup.GetButtonDown not working? 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