Forum rules - please read before posting.

Argument is out of Range, Parameter name: Index

edited December 2015 in Technical Q&A
Hi Guys
Wonder if anyone can help, seem to be getting an error every time I engage in an action in my game (look,talk,use etc) 

The following error crops up every time
Argument is out of Range, Parameter name: Index

Any ideas? This recently popped up from a 100% working build so not sure what I have done to cause this...


FULL ERROR

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[AC.SpeechGap].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
AC.Speech.UpdateInput () (at Assets/AdventureCreator/Scripts/Speech/Speech.cs:497)
AC.Dialog._Update () (at Assets/AdventureCreator/Scripts/Speech/Dialog.cs:57)
AC.StateHandler.Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:225)

Comments

  • Update for you Chris, not sure if it will help. This error popped up on my side when I enabled Scroll Speech text. When I disable it, it goes. 
  • The error is related to speech, so I'm not sure why it's occuring when you trigger Interactions - unless those interactions are causing speech to play.

    Are you using tokens in your speech?  If you can, please provide a sample dialogue line that causes this problem.
  • Hi Chris
    Not using speech tokens but the error has gone now that I removed text scrolling :)
  • Problem recreated. Expect a fix in v1.50.
  • Nice, thanks for working on it Chris, you are a rockstar. 
  • edited August 2017
    Hello, Chris.

    I'm learning Adventure Creator using the 2D demo. I'm recreating it using your Youtube video and finished the Tree Hotspot and interactions (Use/Look). My last session was all fine and the game working well. But after saving the scene, project and reopening today, I'm getting this error when trying the Use/Look Tree interaction:

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[System.Boolean].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    AC.SpeechManager.LanguageReadsRightToLeft (System.String languageName) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:3036)
    AC.Speech..ctor (AC.Char _speaker, System.String _message, Int32 lineID, System.String _language, Boolean _isBackground, Boolean _noAnimation) (at Assets/AdventureCreator/Scripts/Speech/Speech.cs:94)
    AC.Dialog.StartDialog (AC.Char _speaker, System.String _text, Boolean isBackground, Int32 lineID, Boolean noAnimation) (at Assets/AdventureCreator/Scripts/Speech/Dialog.cs:134)
    AC.ActionSpeech.StartSpeech () (at Assets/AdventureCreator/Scripts/Actions/ActionSpeech.cs:480)
    AC.ActionSpeech.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionSpeech.cs:120)
    AC.ActionList+<RunAction>c__Iterator2.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:342)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:306)
    AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:274)
    AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:185)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:154)
    AC.<UseObject>c__Iterator0:MoveNext() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:1236)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    I'm using the latest Unity 2017.01 and Adventure Creator 1.58a.

    Thank you very much for your help.
     Adventure Creator is a wonderful tool which I was looking for years and I'm enjoying a lot. Very good job, congratulations!

    Best regards,
    Rogerio


  • edited August 2017
    Sorry for the trouble.  Can you share any light into what may have caused it?  The issue is related to languages - did you try adding a new language/translation?

    A fix will be issued in the next update, but in the meantime you can fix it by opening SpeechManager.cs, finding line 3036:

    return languageIsRightToLeft[0];

    And inserting the following above it:

    if (languageIsRightToLeft == null || languageIsRightToLeft.Count == 0) { languageIsRightToLeft = new List<bool>(); languageIsRightToLeft.Add (false); }

  • Chris,

    No problem. Did not added a new language or translation yet because I was still repeating the steps of the 2D Demo. I'm still learning more about the capabilities of the Adventure Creator before adapting my project because it's an amazing engine!
     
    My development environment (OSX 10.12.6) is configured to brazilian portuguese (pt_br) profile, which is my native language. We also have different date and number formats here: dd/mm/yyyy and 9.999,99 instead of mm/dd/yyyy and 9,999.99 used in the US. 
     
    One thing that I noted is that when I've created the project the first time, it was working fine. The issue appeared just after these steps:

    a) saving project
    b) closing Unity
    c) reopening it
    d) loading project  

    I'll apply the patch to SpeechManager.cs and feedback you as soon as possible.

    Thank you very much for your support and help. I'm loving AC so much!

    Best regards,
    Rogério
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.