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
-1
Question by ratboy · May 08, 2012 at 03:44 AM · animation2diosnot working

IOS animations don't always play on device..

Problem with 2D Toolkit when running on IOS device, sometimes, randomly, animations won't play and i will get an error (posted at the bottom), sometimes it works, sometimes it doesn't. obviously something to do with my array, or 2dtoolkit itself.. but the animations ALWAYS play on the mac, just sometimes they don't on the device..

Edit : This is the script that I'm having problems with:

     var splatOne : GameObject;
 var splatTwo : GameObject;
 
 private var splats : GameObject[];
 
 private var sound : AudioClip[];
 var sound1 : AudioClip;
 var sound2 : AudioClip;
 var sound3 : AudioClip;
 
 private var buttonPressed : boolean = false;
 
 function Start (){
     splats = new GameObject[2];
     splats[0] = splatOne;
     splats[1] = splatTwo;
 
 
     sound = new AudioClip[3];
     sound[0] = sound1;
     sound[1] = sound2;
     sound[2] = sound3;
 }
 
 function Update(){
     StopRigid();
     var randomSound = sound[Random.Range(0, sound.length)];
     for (var evt : Touch in Input.touches) {
         var quitOn = quit.HitTest(evt.position);
         var retryOn = retry.HitTest(evt.position);
         if (next){
             var nextOn = next.HitTest(evt.position);
         }
         if (evt.phase == TouchPhase.Began) {
             if (quitOn){
                 if (!buttonPressed){
                     var splatNumQuit = splats[Random.Range(0, splats.length)];
                     if (this.gameObject.name == "Win Menu(Clone)001"){
                         PoolManager.Pools["Bloods"].Spawn(splatNumQuit.transform, Vector3(0.6207508,1.584467,-4), Quaternion.identity);
                         AudioSource.PlayClipAtPoint(randomSound, quit.transform.position); 
                         buttonPressed = true;
                     }
                     if (this.gameObject.name == "Lose Menu(Clone)001"){
                         PoolManager.Pools["Bloods"].Spawn(splatNumQuit.transform, Vector3(0.7495953,1.584468,-4), Quaternion.identity);
                         AudioSource.PlayClipAtPoint(randomSound, quit.transform.position);                 
                         buttonPressed = true;    
                     }
                     Quit();
                 }
             }
             if (retryOn){
                 if (!buttonPressed){
                     var splatNumRetry = splats[Random.Range(0, splats.length)];
                     if (this.gameObject.name == "Win Menu(Clone)001"){
                         PoolManager.Pools["Bloods"].Spawn(splatNumRetry.transform, Vector3(1.207713,1.555835,-4), Quaternion.identity);
                         AudioSource.PlayClipAtPoint(randomSound, retry.transform.position);
                         buttonPressed = true;
                     }
                     if (this.gameObject.name == "Lose Menu(Clone)001"){
                         PoolManager.Pools["Bloods"].Spawn(splatNumRetry.transform, Vector3(1.594249,1.584468,-4), Quaternion.identity);
                         AudioSource.PlayClipAtPoint(randomSound, retry.transform.position);
                         buttonPressed = true;
                     }
                     Retry();
                 }
             }
             if (next){
                 if (nextOn){
                     if (!buttonPressed){
                         var splatNumNext = splats[Random.Range(0, splats.length)];
                         PoolManager.Pools["Bloods"].Spawn(splatNumNext.transform, Vector3(1.737412,1.584467,-4), Quaternion.identity);
                         AudioSource.PlayClipAtPoint(randomSound, next.transform.position);
                         buttonPressed = true;
                         Next();
                     }
                 }
             }
         }
     }
 }


NOTE: The script WORKS! on the mac, there are no errors, i found with xCodes internal profiler that whenever i click the button and the graphic doesn't show the following error occurs:

IndexOutOfRangeException: Array index is out of range. at tk2dSprite.Build () [0x00000] in :0 at tk2dSprite.GetCurrentVertexCount () [0x00000] in :0 at tk2dBaseSprite.set_spriteId (Int32 value) [0x00000] in :0 at tk2dBaseSprite.SwitchCollectionAndSprite (.tk2dSpriteCollectionData newCollection, Int32 newSpriteId) [0x00000] in :0 at tk2dAnimatedSprite.SetFrame (Int32 currFrame) [0x00000] in :0 at tk2dAnimatedSprite.Update () [0x00000] in :0

I know that the problem lies within THIS script, and i just can't find a solution, am i missing something? bearing in mind the problem occurs only on the iPad?

Comment
Add comment · Show 3
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 Jessy · May 08, 2012 at 06:37 PM 0
Share

this.gameObject.name is doubly redundant. Just use name.

avatar image ratboy · May 08, 2012 at 06:40 PM 0
Share

Will give it a go, not sure that will sort the array exception problem out though.

avatar image ratboy · May 08, 2012 at 06:49 PM 0
Share

nope, although i suppose it does help to optimise my script. thanks anyway.

1 Reply

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

Answer by ratboy · Jul 29, 2012 at 11:58 AM

must have just been a build issue. i think i restarted everything, cleaned the ipad, maybe even reinstalled tk2d.. just one of those things.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

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

2d animation import 1 Answer

Animation in Unity 4.3 0 Answers

Some animations not looping how I want 1 Answer

Animating a cubemaps orientation 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