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 DoctorWhy · Jun 28, 2013 at 10:35 PM · monobehaviourduplicatepost effects

Duplicate Monobehaviour

I am trying to duplicate one Monobehaviour script onto another gameObject. How would I go about doing this in code?

Basically, I have a bunch of dynamic post effects on the camera I would like to duplicate onto another gameObject. I won't necessarily know what specific post effects will be on the camera.

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 Benproductions1 · Jun 29, 2013 at 03:07 AM 0
Share

Why can't you just save the camera in a prefab and Instantiate it again?

avatar image DoctorWhy · Jun 29, 2013 at 04:05 AM 0
Share

That is a work around that won't quite work and this will require an explanation of what I am doing. Basically, I am making an asset bundle for a level which include light probes, lightmapping (all of that is done), and camera post effects. Now, turning the camera into a prefab and reinstantiating it would work to save the post effects normally, but how would I then get the post effects off of the camera and onto the scene camera (that camera is even more complicated)? At one point in the pipeline, the effects need to be moved over one way or the other.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ray-Pendergraph · Jun 29, 2013 at 02:43 PM

You cannot just put a MonoBehaviour instance that was created on one game object onto another. Probably your best bet is to write a Copy(MyController anotherController) method and copy all the attributes that would make it (for your purposes) identical. It will not however have the same unique identifier and will not be the same object. If you need == or .Equals to work you can override these to make it act like the same based on your important attributes. If you want to do that check out this link

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

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

Related Questions

What process should I best use to properly create an updated copy of a Prefab? 1 Answer

How to have a cloned/duplicated enemy react the same way the original does? 1 Answer

Problem enemy ragdoll duplicate. 0 Answers

Duplication(instance) re-create deleted children 0 Answers

How to make duplicate unique? 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