Skip to content

Copy Components

FACS01-01 edited this page Apr 17, 2024 · 3 revisions

Helps you copy Components from a GameObject and all its children, to another GameObject.

There are no hardcoded Components in this tool, meaning you will be able to copy any built-in and custom script Component (MonoBehaviour) you need.

The tool copies data from the Component's Serialized Fields, permanent data that is stored in your Project assets and loaded back when the asset is used. It doesn't copy temporary data managed by the Component, though in the mayority of cases this won't cause problems.

How to use

  1. Open its window from the menu FACS Utils/Copy/Copy Components.
  2. Put the root GameObject of what you want to copy from, into the Copy From object selector, and press Scan!.
  3. Put the root GameObject of what you want to receive the copying, into the Copy To object selector.
  4. Use the checkboxes to select what Components to copy.
  5. When ready, press the Copy! button.

Extra tips and notes

  • You can select Prefabs or unpacked GameObjects, from Scene or Project folders, to copy From and To.
  • If Copy To is missing some child GameObjects necessary to place the selected Components from Copy From, they will be created and their Transforms copied too.
    • Newly created GameObjects, when coming from Prefabs, won't be linked back to them, ending up "unpacked".
    • During GameObject creation, its Layer and Tag are also copied. Those aren't copied to pre-existing GameObjects.
  • If you are copying between GameObjects with pre-existing Children Hierarchies (instead of copying things into an empty GameObject), mind that the copying process looks for matching GameObject Names between both hierarchies.
    • If you have avatars with different Armature/bone names, copying between them would keep both named bones instead of merging them, slightly breaking the avatar. On this cases, rename the required GameObjects/bones to get a matching hierarchy.
  • If you are copying between characters/avatars, I recommend not copying the Animator in the avatar's root. It contains skeleton data that shouldn't be modified. Try use the avatar with more complete skeleton as your Copy To.
  • If you are copying between characters/avatars, make sure to have the same Scale in each pair of GameObjects/Transforms, to avoid size mismatches on bones, meshes and Component behaviours.
  • You can automatically select other Components referenced by the currently selected ones, with the button Select Component Dependencies. It will only add direct dependencies, so if you want to add "dependencies of dependencies" press the button multiple times, or enable Recursive Selection.
  • You can easily split/isolate a character's/avatar's meshes (for example), very clean with no unnecesary GameObjects or Components, by selecting a single or a group of Skinned Mesh Renderers, then selecting all dependencies, and copying to an empty GameObject.
  • Careful while copying Components with "implicit dependencies". With this I mean Components that require other Components/GameObjects to work, that are not explicitly saved in any of the Component's fields. Select Component Dependencies would not detect them, so you will have to select them manually.
    • An example would be Dynamic Bones, depending on the chain of GameObjects under its root Transform.
    • Another example is Particle System component, that depends on a Particle System Renderer component located in the same GameObject.
  • The tool provides 2 types of visualizations so you can locate the Components to copy more easily: List View and Hierarchy View.