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 i.spirov · Nov 24, 2011 at 09:32 PM · nullreferenceexceptionitween

Need help with iTween manual skip and device hang

Hello all! I have been struggling for about a week with this problem. I make comic animations using iTween. I need some help on fixing this code. The idea is that the user can skip/speed up the comic by tapping. I stop the current iTween and set it manually at the final position, and just run the next iTween. The problem: the iPad or iPod device sometimes hangs when I try to skip the comics. Here is the code I'm using:

 #pragma strict
 #pragma downcast
 public var fadeInTime:float;
 public var timePerFrame:float = 2;
 public var plane1: GameObject;
 public var slideSpeed: float = 25;
 public var scaleSpeed: float = 1;
 public var canSkip: boolean = true;
 private var plane1Scale: Vector3;
 private var currentFrame: int=0;
 
 function Start() {
     iTween.CameraFadeAdd();    
     iTween.CameraFadeFrom({
         "amount":1,
         "time":fadeInTime,
         "onComplete":"comicsStart",
         "onCompleteTarget":transform.gameObject
     });
 }
 function Awake() {
     plane1Scale=plane1.transform.localScale;
 }
 function Update() {
     getInput();
 }
 
 function comicsStart() {
         //Move and scale down from right
         currentFrame=1;
         iTween.CameraFadeDestroy();
         plane1.renderer.enabled=true;
         iTween.MoveFrom(plane1,{
             "x":55,
             "time":fadeInTime,
             "delay":1,
             "easetype":"easeOutCirc",
             "speed":slideSpeed,
             "onComplete":"showPanel2",
             "onCompleteParams":timePerFrame,
             "onCompleteTarget":transform.gameObject
         });
         iTween.ScaleFrom(plane1,{
             "x":5.7,
             "y":3,
             "z":4.4,
             "delay":1,
             "easetype":"easeOutSine",
             "speed":scaleSpeed/2
         });
     }
 
 function showPanel2() {
     //Move away and scale down
     currentFrame=2;
     iTween.MoveTo(plane1,{
                 "x":-55,
                 "time":fadeInTime,
                 "delay":timePerFrame,
                 "easetype":"easeInCirc",
                 "speed":slideSpeed,
                 "onComplete":"fadeOut",
                 "onCompleteParams":0,
                 "onCompleteTarget":transform.gameObject
             });
         iTween.ScaleTo(plane1,{
                 "x":0,
                 "y":0,
                 "z":0,
                 "delay":timePerFrame,
                 "easetype":"easeInSine",
                 "speed":scaleSpeed*2
             });
 }
         
 function fadeOut(tempDelay:float) {
     currentFrame=3;
     iTween.CameraFadeAdd();
     iTween.CameraFadeTo({
         "amount":1,
         "time":fadeInTime,
         "delay":tempDelay*2,
         "onComplete":"endComics",
         "onCompleteTarget":transform.gameObject
     });
         
 }
     
 function endComics() {
     Application.LoadLevel(Scenes.WORLD_MAP);
 }
 
 function getInput() {
     if (canSkip==true) {
         if (CursorUtils.hitState() == HitState.Down) {
             skipComics();
         }
     }
 }            
 
 function skipComics() {
     switch (currentFrame) {
         case 1 :
             iTween.Stop(plane1);
             plane1.transform.position=Vector3(0,0,0);
             plane1.transform.localScale=plane1Scale;
             timePerFrame=0.5;
             showPanel2();
             break;
         case 2 :
             iTween.Stop(plane1);
             fadeOut(0);
             break;
     }    
 }


When I leave the animation to play without interrupting it with iTween.Stop() or iTween.StopByName() it works on the iPad. When I try to skip it sometimes just hangs and I recieve the following in Xcode:

 (Filename:  Line: -1)
 
     NullReferenceException
       at iTween.Stop (UnityEngine.GameObject target) [0x00000] in <filename unknown>:0 
       at iTween.Stop () [0x00000] in <filename unknown>:0 
       at ShaolinDepart_Comics01_Script.skipComics () [0x00000] in <filename unknown>:0 
       at ShaolinDepart_Comics01_Script.getInput () [0x00000] in <filename unknown>:0 
       at ShaolinDepart_Comics01_Script.Update () [0x00000] in <filename unknown>:0 

..which I don't know what it means.

I use Unity 3.3 and Xcode 4.2.

Thanks for your help in advance and I need this ASAP. Thanks!

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

2 People are following this question.

avatar image avatar image

Related Questions

iTween can't access instantiated child. 1 Answer

iTween NullReferenceException error 1 Answer

Using iTween with a prefab tree. 0 Answers

iTween call producing NullReferenceException 3 Answers

iTween - Null Reference 0 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