Copy Components - FACS01-01/FACS_Utilities GitHub Wiki
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
- Open its window from the menu
FACS Utils/Copy/Copy Components
. - Put the root
GameObject
of what you want to copy from, into the Copy From object selector, and press Scan!. - Put the root
GameObject
of what you want to receive the copying, into the Copy To object selector. - Use the checkboxes to select what
Components
to copy. - When ready, press the Copy! button.
Extra tips and notes
- You can select
Prefabs
or unpackedGameObjects
, fromScene
or Project folders, to copy From and To. - If Copy To is missing some child
GameObjects
necessary to place the selectedComponents
from Copy From, they will be created and theirTransforms
copied too.- Newly created
GameObjects
, when coming fromPrefabs
, 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-existingGameObjects
.
- Newly created
- If you are copying between
GameObjects
with pre-existing Children Hierarchies (instead of copying things into an emptyGameObject
), mind that the copying process looks for matchingGameObject
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 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
- 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 andComponent
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
orComponents
, by selecting a single or a group ofSkinned Mesh Renderers
, then selecting all dependencies, and copying to an emptyGameObject
. - Careful while copying
Components
with "implicit dependencies". With this I mean Components that require otherComponents
/GameObjects
to work, that are not explicitly saved in any of theComponent
'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 rootTransform
. - Another example is
Particle System
component, that depends on aParticle System Renderer
component located in the sameGameObject
.
- An example would be Dynamic Bones, depending on the chain of
- The tool provides 2 types of visualizations so you can locate the
Components
to copy more easily: List View and Hierarchy View.