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 Catlard · Nov 02, 2011 at 07:38 PM · nullreferenceexceptionitween

iTween call producing NullReferenceException

Hey, guys.

When I run this short script, I'm getting a NullReferenceException error. I have no idea why. The error points to this line in iTween:

 if(tweenArguments.Contains("looktarget") && isRunning){

I know it's the "MoveBy" call, because the other part is working correctly--but no luck with the first bit.

Here's the script. Any ideas about what I'm doing wrong?

UPDATE: Tried using even a basic MoveBy iTween, and no luck. Is there something wrong with the way I'm calling it from the Start function?

 private var moveTime;
 private var moveDistance;
 private var fadeTime;
 
 function Start()
 {
         moveTime = Random.Range(3,4);
         moveDistance = Random.Range(.1,.3);
         fadeTime = Random.Range(1,4);
         moveDown();
         fadeOut();
 }
 
 function moveDown()
 {
     
     iTween.MoveBy(gameObject, {"amount" : Vector3(0,-1*moveDistance,0), "time": moveTime, "easetype" : "easeInOutQuad", "oncomplete" : "moveUp", "oncompletetarget" : gameObject});
 }
 
 function moveUp()
 {
     iTween.MoveBy(gameObject, {"amount" : Vector3(0,moveDistance,0), "time": moveTime, "easetype" : "easeInOutQuad", "oncomplete" : "moveDown", "oncompletetarget" : gameObject});
 }
 
 function fadeOut()
 {
     iTween.FadeTo(gameObject, {"alpha" : 0, "time": fadeTime, "easetype" : "easeInOutQuad", "oncomplete" : "fadeIn"});
 }
 
 function fadeIn()
 {
     iTween.FadeTo(gameObject, {"alpha" : 1, "time": fadeTime, "easetype" : "easeInOutQuad", "oncomplete" : "fadeOut"});
 }
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 Branislav · Nov 03, 2011 at 07:48 AM 0
Share

$$anonymous$$aybe the object is destroyed before iTween is finished?

avatar image Catlard · Nov 03, 2011 at 10:10 AM 0
Share

Thanks for thinking about it with me! But destroyed how? I'm not destroying it in this script...and I've just written the object, so there's no chance of it being destroyed by another script, I don't htink....

avatar image dannyskim · Nov 07, 2011 at 07:09 PM 0
Share

Hmm, can't technically see anything wrong. Is there any reason why you are calling "oncompletetarget" on the $$anonymous$$oveBy's? You shouldn't have to reference that. I haven't looked through the iTween source but it's possible there's an exception error if you try to declare the target to itself.

3 Replies

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

Answer by funasylum · Apr 10, 2012 at 05:36 AM

SOLVED--

Okay user error: turns out I had TWO iTween folders (ie duplicates) in my project. I guess when I updated once it didn't overwrite the old one, and gave me a new different version instead. So I had two iTween versions coexisting.

Ugh. That took me four hours of my life to figure out.

But once I deleted the old iTween folder it now works fine. Hope someone finds that helpful!

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
avatar image
1

Answer by funasylum · Apr 10, 2012 at 02:55 AM

I'd like to confirm that this happened to me too. This must be some sort of iTween bug.

Not sure how-- but four separate iTween scripts mysteriously appeared on my game object. I didn't put them there! In fact, they were set to a quadratic ease (default?) which I hadn't used... so no idea how they appeared.

I notice that when I hit play, iTween does instantiate some sort of iTween script on my gameobject. However it usually disappears when you hit stop. Several accrued on my go however. Perhaps if I crashed or something the instantiated script stuck to my prefab and then didn't destroy? Very weird and annoying bug!

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
avatar image
0

Answer by JoeProgram · Jan 03, 2012 at 11:44 PM

I had an unexpected Null Reference Exception from iTween happen to me when the iTween script was mysteriously set on a GameObject in the inspector. Perhaps that happened to you too.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iTween nullref error. Hashtable syntax problem? Not sure. 3 Answers

iTween MoveBy with Transforms 1 Answer

iTween can't access instantiated child. 1 Answer

iTween NullReferenceException error 1 Answer

Using iTween with a prefab tree. 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