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 MountDoomTeam · Sep 22, 2012 at 08:16 PM · prefabselectioncopypaste

Any way to copy and paste GameObjects programatically?

It would be a useful feature. it's impossible to copy objects to a prefab without using an Editor Script so you can't copy an object to a prefab without using a menu option.

Perhaps it's possible to make a "copy to prefab/paste from prefab" function in an Editor Script and access it from a Normal Script?

I dont think it's possible to edit the objects in the Selection of hierarchy, which is held in an array somewhere, and i didnt see any selection copy/paste options in reference.

Is there any way to store GameObjects to a kind of memory and paste them into the game elsewhere?

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

1 Reply

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

Answer by Muuskii · Sep 22, 2012 at 09:03 PM

You mean like a deep copy? What specifically are you trying to accomplish here?

From Object.Instantiate

This is essentially the same as using duplicate command (cmd-d) in Unity and then moving the object to the given location

Comment
Add comment · Show 4 · 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 MountDoomTeam · Sep 22, 2012 at 11:02 PM 0
Share

Thanks $$anonymous$$uuskii! O$$anonymous$$G i didnt realise! i thought you could just instantiate prefabs, although it may be O$$anonymous$$ to instantiate to copy game objects. ok.

I am making some geometry with central symmetries, and as it's procedural, it's best to make the mesh on the fly and then copy the symmetries, and it also makes the code simpler and easier to control via modular program$$anonymous$$g.

avatar image Muuskii · Sep 22, 2012 at 11:11 PM 0
Share

You're welcome. The idea of instantiating non prefabs is an alien idea to me as well. I don't usually use it ever.

If the answer solves your question, please do mark it as correct.

Thank you.

avatar image MountDoomTeam · Sep 24, 2012 at 06:50 PM 0
Share

hiya, i vote for the answer, it means i mark it as correct? there is another option?

avatar image Muuskii · Sep 24, 2012 at 06:52 PM 0
Share

There should also be a checkmark button underneath where you see the thumbs up and down buttons. Click that to indicate that an answer is correct.

Thank you/

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

11 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

Related Questions

How do I keep a texture different on copied objects? 1 Answer

How to set prefab's script value programatically? 1 Answer

Can a prefab be written in code? 3 Answers

Monster Spawner 3 Answers

Coin collecting with prefabs 2 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