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 Chris12345 · Jul 22, 2013 at 03:05 PM · itweenitweenpath

Itween Path Change vector3 list to game objects list?

Hello how can a set the nodes list in the editor to GameObjects and not vector?

  // Copyright (c) 2010 Bob Berkebile
 // Please direct any bugs/comments/suggestions to http://www.pixelplacement.com
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
 // in the Software without restriction, including without limitation the rights
 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 // copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
 //
 // The above copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
 //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 using UnityEngine;
 using System.Collections.Generic;
 
 [AddComponentMenu("Pixelplacement/iTweenPath")]
 public class iTweenPath : MonoBehaviour
 {
     public string pathName ="";
     public Color pathColor = Color.cyan;
     public List<Vector3> nodes = new List<Vector3>(){Vector3.zero, Vector3.zero};
     public int nodeCount;
     public static Dictionary<string, iTweenPath> paths = new Dictionary<string, iTweenPath>();
     public bool initialized = false;
     public string initialName = "";
     public bool pathVisible = true;
         
     void OnEnable(){
         if(!paths.ContainsKey(pathName)){
             paths.Add(pathName.ToLower(), this);
         }
     }
     
     void OnDisable(){
         paths.Remove(pathName.ToLower());
     }
     
     void OnDrawGizmosSelected(){
         if(pathVisible){
             if(nodes.Count > 0){
                 iTween.DrawPath(nodes.ToArray(), pathColor);
             }    
         }
     }
     
     /// <summary>
     /// Returns the visually edited path as a Vector3 array.
     /// </summary>
     /// <param name="requestedName">
     /// A <see cref="System.String"/> the requested name of a path.
     /// </param>
     /// <returns>
     /// A <see cref="Vector3[]"/>
     /// </returns>
     public static Vector3[] GetPath(string requestedName){
         requestedName = requestedName.ToLower();
         if(paths.ContainsKey(requestedName)){
             return paths[requestedName].nodes.ToArray();
         }else{
             Debug.Log("No path with that name (" + requestedName + ") exists! Are you sure you wrote it correctly?");
             return null;
         }
     }
     
     /// <summary>
     /// Returns the reversed visually edited path as a Vector3 array.
     /// </summary>
     /// <param name="requestedName">
     /// A <see cref="System.String"/> the requested name of a path.
     /// </param>
     /// <returns>
     /// A <see cref="Vector3[]"/>
     /// </returns>
     public static Vector3[] GetPathReversed(string requestedName){
         requestedName = requestedName.ToLower();
         if(paths.ContainsKey(requestedName)){
             List<Vector3>  revNodes = paths[requestedName].nodes.GetRange(0,paths[requestedName].nodes.Count);
             revNodes.Reverse();
             return revNodes.ToArray();
         }else{
             Debug.Log("No path with that name (" + requestedName + ") exists! Are you sure you wrote it correctly?");
             return null;
         }
     }
 }
Comment
Add comment · Show 2
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 Chris12345 · Jul 22, 2013 at 04:10 PM 0
Share

fixed it, sorry

avatar image robertbu · Jul 23, 2013 at 06:54 AM 0
Share

I took a quick look. I'm not sure what your goal is here. The paths that this script uses appear to be built in another script...iTweenPathEditor. There is Unity code here (iTweenPathEditor) that I am not familiar with, but it appears to use Handles, not game objects, so there are no game objects to populate the list with even if the above code could be changed.

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

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

Related Questions

A node in a childnode? 1 Answer

iTween Path not realtime ?! 0 Answers

Does iTweenpath support OnTriggerEnter? 2 Answers

iTween MoveTo "Convoy" 0 Answers

Instantiate an object around the player following a path built with iTween asset 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