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 Daniel G · Jul 08, 2013 at 03:31 PM · javascriptitweenstrings

Using private class strings with iTween event calls

Hello, I am wondering if it is possible to call an iTween event on a string of gameobjects? I'm getting an error currently, see picture below.

I would like to call iTween events on any number of gameobjects, when it finds the object that has the script on it, it runs that script.

So this is the kind of inspector look i am striving for:

alt text

and here is the code snippets that I added:

 var Levels:LevelCount[];
 private class LevelCount {
     var Level : GameObject;
 }
 
 //This is found in the function update in an if statement, SEE FULL CODE for placement.
 iTweenEvent.GetEvent(Levels, "L1MoveLToGridSpace3").Play();

Full Code:

 var ButtonLeft: boolean;
 var ButtonRight: boolean;
 var GridCount = 0;
 var Levels:LevelCount[];
 private class LevelCount {
     var Level : GameObject;
 }
 function Update () {
 // verify if one of the arrows was clicked:
   DetectButtonClick();
   // now you have ButtonLeft or ButtonRight true if the corresponding
   // arrows were clicked - place your code here
   GridSystem ();
 } 
 function DetectButtonClick(){
   ButtonLeft = false; // assume no clicks initially
   ButtonRight = false;
   if (Input.GetMouseButtonDown(0)){ // if left button pressed...
     // create a ray passing through the mouse pointer:
     var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
     var hit: RaycastHit;
     if (Physics.Raycast(ray, hit)){ // do a raycast
       if (hit.transform.name == "ArrowLeft"){ // left arrow clicked?
         ButtonLeft = true;
         //Debug.Log ("you pressed the left arrow");
       } 
       else
       if (hit.transform.name == "ArrowRight"){ // right arrow clicked?
         ButtonRight = true;
         //Debug.Log ("you pressed the right arrow");
       }
     }
   }
 }
 
 function GridSystem () {
  
     if (ButtonRight) {
        GridCount++;
        //print("Right Arrow clicked");
     }
     if (ButtonLeft) {
        GridCount--;
        //print("Left Arrow clicked");
     }
     GridCount = Mathf.Clamp (GridCount, 0, 2);
     
     
     if (GridCount == 0) {
         
         if (ButtonRight) {
             //Move all level objs left one grid
             Debug.Log (GridCount);
         }
         
         if (ButtonLeft) {
             //Move all level objs right one grid
             iTweenEvent.GetEvent(Levels, "L1MoveLToGridSpace3").Play();
             //Debug.Log (GridCount);
         }
     }
     
     if (GridCount == 1) {
         
         if (ButtonRight) {
             //Move all level objs left one grid
             Debug.Log (GridCount);
         }
         
         if (ButtonLeft) {
             //Move all level objs right one grid
             Debug.Log (GridCount);
         }
     }
     
     if (GridCount == 2) {
         
         if (ButtonRight) {
             //Move all level objs left one grid
             Debug.Log (GridCount);
         }
         
         if (ButtonLeft) {
             //Move all level objs right one grid
             Debug.Log (GridCount);
         }
     }
 
 }
 




and my error i receive, when i try to use the Levels string to access the gameobjects i attached to this script in the inspector, in order to find an event name thats specific to just one of those "Levels".

alt text

Thanks for the help, Daniel

Just for the heads up i am using the iTween Visual Inspector Editor (it creates a script at runtime thats when the animation is called).

screen shot 2013-07-08 at 11.28.15 am.png (49.6 kB)
screen shot 2013-07-08 at 11.23.53 am.png (38.2 kB)
Comment
Add comment · Show 1
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 Daniel G · Jul 08, 2013 at 06:34 PM 0
Share

I believe what i am trying to do may be impossible, If any one still has an idea let me know! Thanks

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

14 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

iTween Visual Editor Event Call from C# to Javascript 1 Answer

What is wrong with this script? 2 Answers

How to Implement System.StringBuilder into JavaScript? 2 Answers

2.5D ledge hang with javascript 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