Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by bbrode · Sep 15, 2011 at 12:06 AM · gameobjectcomponentmoveitween

Can I move a component from one GameObject to another in script?

I want to swap a gameobject out for another one in script and move the itween component from the first gameobject to second so it continues along the smooth path that the first one had started. Is this possible?

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 bbrode · Sep 18, 2011 at 05:47 AM 0
Share

Just to clarify - I need to know how to do this, not just if it's possible. Sorry for the confusion.

1 Reply

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

Answer by syclamoth · Sep 15, 2011 at 01:29 AM

Moving components around is a tricky thing to want to do- often components can have complex dependencies which make it difficult to be sure they will still work after cloning. What exactly do you mean by "swap a gameObject out"? If you only want to change what it looks like, you can swap out the mesh and texture data much more easily than moving around whole components, since these are just parameters of common components. If I were you, I would look at what it is exactly that you want to do, and try to do that instead. What are the important differences between your original object and the one it is being replaced by? Is there anything large enough to actually justify changing the entire gameObject?

EDIT- To clarify, to do what you want to do, you need to put the iTween component on to a parent object which moves around, and make the replaced GameObject a transform child of that object, so that it can be swapped out. This way, the iTween component is not affected by the swap, and you still get to have a completely different GameObject afterwards.

Comment
Add comment · Show 2 · 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 bbrode · Sep 18, 2011 at 05:43 AM 0
Share

I am sure it will work after I clone it. Yes, it's important that I replace the object completely, and not just a part of the object.

avatar image syclamoth · Sep 18, 2011 at 08:31 AM 0
Share

What exactly does your gameobject do? What are the changes you will be making? While it is very difficult to just swap a component out the way you want to, I still think it should be possible to make something work the way you want it to- I just need to know what, exactly, you need to do! Is the reason you can't just swap mesh data because you need different scripts on each GameObject, and those don't come easily? At this point, I would make the gameObject you want to swap around be a referenced variable on the swapper script, and put the functionality from the iTween component inside of a controller object which watches from above so that it doesn't get destroyed when you make the swap.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How would I go about moving a group of objects as one using iTween? 1 Answer

check if object is moving 5 Answers

Sharing components amongst different gameobjects 1 Answer

Itween gradual jump 2d 1 Answer

iTween how to define what object will be tweened 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