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 /
  • Help Room /
avatar image
0
Question by LPTFabio · May 26, 2017 at 12:32 PM · erroritweenindexoutofrangeexceptionputonpath

Strange Error with Itween PutOnPath

Dont hate, this is my first game. i only have high-school any advice is greatly appreciated CODE FIRST (without Error):

 private Vector3 stuff;
     private Vector3[] pathR;
     private Vector3[] pathM;
     private Vector3[] pathL;
     private Vector3[] pathUR;
     private Vector3[] pathUM;
     private Vector3[] pathUL;
     private Vector3[] pathDR;
     private Vector3[] pathDM;
     private Vector3[] pathDL;
     private Vector3[] currPath;
     public string strPath;
     private float countTime= 0;
     private float percent;
     private bool move = false;
     private bool possible = false;
     private float timeFixed; 
     private float futurePercent; 
     private float futureRotate; 
     private float tempoTotal = 10f;
     private float tempoTroca = 1f;
     private float lookTime = 2f;
     // Use this for initialization
     void Start () {
         //etc...
         player = GetComponent<Transform> ();
         alien = GetComponent<CharacterController> (); 
         cameraTransform = GameObject.FindGameObjectWithTag("MainCamera").transform;
 
         //Adicionar propriedades aos caminhos
         iTween.Hash("path", iTweenPath.GetPath("MidPath"), "time",tempoTotal ,"orienttopath", true, "easetype", iTween.EaseType.linear );    
         iTween.Hash("path", iTweenPath.GetPath("LeftPath"), "time",tempoTotal ,"orienttopath", true, "easetype", iTween.EaseType.linear);    
         iTween.Hash("path", iTweenPath.GetPath("RightPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);
         iTween.Hash("path", iTweenPath.GetPath("UpMidPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);    
         iTween.Hash("path", iTweenPath.GetPath("UpLeftPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);    
         iTween.Hash("path", iTweenPath.GetPath("UpRightPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);
         iTween.Hash("path", iTweenPath.GetPath("DownMidPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);    
         iTween.Hash("path", iTweenPath.GetPath("DownLeftPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);    
         iTween.Hash("path", iTweenPath.GetPath("DownRightPath"), "time",tempoTotal ,"orienttopath", true,  "easetype", iTween.EaseType.linear);
         //Caminhos em array
         pathM = iTweenPath.GetPath ("MidPath");
         pathL = iTweenPath.GetPath ("LeftPath");
         pathR = iTweenPath.GetPath ("RightPath");
         pathUM = iTweenPath.GetPath ("UpMidPath");
         pathUL = iTweenPath.GetPath ("UpLeftPath");
         pathUR = iTweenPath.GetPath ("UpRightPath");
         pathDM = iTweenPath.GetPath ("DownMidPath");
         pathDL = iTweenPath.GetPath ("DownLeftPath");
         pathDR = iTweenPath.GetPath ("DownRightPath");
         strPath = "mid";
         currPath = pathM;
 
     }
 
 (...)
 void LateUpdate(){
         countTime += Time.deltaTime; 
         percent = (countTime / tempoTotal)-0.001f; 
         futurePercent =((tempoTroca+countTime) / tempoTotal)-0.001f; 
         futureRotate =(countTime / tempoTotal)+0.201f;
         possible=false;
         if (Input.GetKeyDown(KeyCode.LeftArrow)) {
             if (strPath == "right") {
                 possible = true;
                 currPath = pathM;
                 strPath = "mid";
                 stuff = iTween.PointOnPath(iTweenPath.GetPath("MidPath"), futurePercent);
             } 
 (...)
         if (move == false || countTime > timeFixed) {
             move = false;
             iTween.LookUpdate (gameObject, iTween.Hash("looktarget", stuff, "time", lookTime));
 
             if (countTime <= tempoTotal)
             Error here--->iTween.PutOnPath (gameObject, currPath, percent);<----Error here
             stuff = iTween.PointOnPath(currPath, futureRotate);
 
         }

The following Error appears when i change "tempoTotal" value to 20 or above. i change nothing in the code only the "tempoTotal" value. anyone knows what error is this?

PS: the game still runs without error and does everything so far

IndexOutOfRangeException: Array index is out of range. iTween.Interp (UnityEngine.Vector3[] pts, Single t) (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:6708) iTween.PutOnPath (UnityEngine.GameObject target, UnityEngine.Vector3[] path, Single percent) (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:5495) PlayerMotor.LateUpdate () (at Assets/scripts/PlayerMotor.cs:355)

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

0 Replies

· Add your reply
  • Sort: 

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

Unity C# array index is out of range 1 Answer

iTween Switching Paths 0 Answers

IndexOutOfRangeException: Index was outside the bounds of the array. (wrapper managed-to-managed) System.Object.ElementAddr_4(object,int,int,int) 0 Answers

Array index is out of range (C#)? 1 Answer

Array index is out of range??? (Day Night Cycle Script) 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