• 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 Valentin_B · Nov 17, 2014 at 03:38 PM · prefabs

Copying prefabs without using packages

Hi everyone,

I'm currently developping a rather complex network project, and in order to optimize my workflow I have been improving an external tool (python) that syncs projects between them.

It works fine for scripts and scenes, but fails to accurately synchronize prefabs, components and hierarchy-wise.

Since the goal is to automate the process of synchronizing the prefabs, I'm not using the package export feature (my script is merely brute-copying any file that has a detected change).

I'm aware this is a bit outside the box, but a tip on how to copy prefabs proceduraly from project to project would help me a great deal,

thanks in advance

Comment
Add comment · Show 9
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 Immanuel-Scholz · Nov 17, 2014 at 04:07 PM 0
Share

I can't think of a reason why it should work with scenes but not with prefabs. What are the problems you experience? Do you copy the meta files as well?

avatar image Valentin_B · Nov 18, 2014 at 07:59 AM 0
Share

Yes, the meta files are being copied as well. The problem is that the hierarchy of the gameObject, or the deletion/add of one of its component will not be "echoed" to the other project instances, although the .prefab and .meta files being copied as soon as modified.

Is there anything I'm missing about prefabs?

avatar image incorrect · Nov 18, 2014 at 09:07 AM 1
Share

I guess there is something you are missing about metafiles. As I understand Unity automatically assigns some signatures to assets and operates with them so you can change names and modify those files but the links to them will keep working. So probably you can not just copy-paste those assets with metafiles because dependencies will be broken.

avatar image Immanuel-Scholz · Nov 18, 2014 at 10:13 AM 1
Share

As I understand Unity automatically assigns some signatures to assets and operates with them so you can change names and modify those files but the links to them will keep working.

Exactly. But this signature isn't hidden or magic. Its the GUID assigned in the .meta to the whole prefab file together with the FileID within that .prefab to reference parts of the prefab (e.g. reference its transform component). All these informations are inside the meta or prefab file.

What Unity could have problems with are duplicated GUID's. If you have the same GUID in the project you are copying the prefab to, then unity will emit a warning and assigning a new random GUID.

That is as true for prefabs as it is for every other GUID (scenes, scripts, even folders)

hierarchy of the gameObject, or the deletion/add of one of its component will not be "echoed" to the other project instances

If they are still intact prefab instances (blue in the hierarchy) then this should work :(.

Did it here too a couple of times and copying prefabs (together with their metas) will reflect correctly as long as you don't change the File ID's (there are only few operations that can change an file ID and this will break all links - even the one in the original project. Like removing a referenced component and later adding it again will break references to that component.)

$$anonymous$$aybe you set up a tiny test case and report this as a bug.

You are using forced text format, right?

avatar image Valentin_B · Nov 18, 2014 at 10:33 AM 0
Share

You are using forced text format, right?

Nope, I wasn't aware there was such a thing... setting this up right away, I'll keep you posted. Thanks!

Show more comments

1 Reply

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

Answer by Shbli · Nov 18, 2014 at 09:20 AM

When I used Dropbox, we used to work on the same project 2 guys at the same time, thus, when I change the prefab, it doesn't affect the other user while actually the files have Synced.

So what I was doing is, duplicating that prefab from my side (Then Unity3D editor will refresh all prefabs in that folder on the other machine)

After that is done, I delete that prefab from my Machine, this is because both machine have Unity3D editor running and none is willing to close and open his Unity3D again.

Changing scripts was syncing without any problem, or any need to duplicated or something.

Maybe you can change your prefabs to text based prefabs? They'll be text files instead of binary!

I'm not sure if my case in Dropbox helps you, but maybe it gives you idea what to do!

Comment
Add comment · Show 3 · 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 Valentin_B · Nov 18, 2014 at 10:29 AM 0
Share

I did not even know there was a text serialization mode for assets, I'm going to try something in that direction... Thanks

avatar image Shbli · Nov 18, 2014 at 10:34 AM 0
Share

It's here:

http://docs.unity3d.com/$$anonymous$$anual/class-Editor$$anonymous$$anager.html

avatar image Valentin_B · Nov 19, 2014 at 08:11 AM 0
Share

So, I'll mark this as an accepted answer, Improving my code a little bit (especially the folder polling parts) and setting my assets to "text serialization seems to have done the trick, thanks

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Related Questions

Can the animation editor create local rotational data? 3 Answers

Unity Water Help 2 Answers

Joining separated prefabs to one source prefab 0 Answers

Scaling down dynamically created objects 1 Answer

Prefab linking 3 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