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
GameObjectof what you want to copy from, into the Copy From object selector, and press Scan!. - Put the root
GameObjectof what you want to receive the copying, into the Copy To object selector. - Use the checkboxes to select what
Componentsto copy. - When ready, press the Copy! button.
More functionalities
- You can automatically select other
Componentsreferenced by your current Component selection, 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. - When having Copy From and Copy To assigned, and at least one
Componentselected to be copied, a foldout menu with Advanced Options will show up. Use them to filter your current Component selection. Available toggles are:- Matching components Only: won't add new
Componentsto destination. - Skip Matching components: won't modify existing
Componentsin destination. - Matching paths Only: won't add unmatching/missing
GameObjectsto destination, also skipping all childrenComponents.
- Matching components Only: won't add new
- Advanced Options are used by the Copy Algorithm to skip
Components, without modifying your current Component selection. If you prefer or want to apply the filters and deselect them/remove them from your Component selection, press the Filter Selection button.
Extra tips and notes
- You can select
Prefabsor unpackedGameObjects, fromSceneor Project folders, to copy From and To. - If Copy To is missing some child
GameObjectsnecessary to place the selectedComponentsfrom Copy From, they will be created and theirTransformscopied too.- Newly created
GameObjects, when coming fromPrefabs, won't be linked back to them, ending up "unpacked".
- Newly created
- The
GameObjectTagsandHideFlagsproperties are not copied when Copy From comes from anAssetBundlePrefab, loaded using FACS LoadBundle. - If you are copying between
GameObjectswith pre-existing Children Hierarchies (instead of copying things into an emptyGameObject), mind that the copying process looks for matchingGameObjectNames 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. In 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. In this cases, rename the required
- If you are copying between characters/avatars, I recommend not copying the
Animatorin 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 andComponentbehaviours. - You can easily split/isolate a character's/avatar's meshes (for example), very clean with no unnecesary
GameObjectsorComponents, by selecting a single or a group ofSkinned Mesh Renderers, then selecting all dependencies, and copying to an emptyGameObject. - Careful while copying
Componentswith "implicit dependencies". With this I mean Components that require otherComponents/GameObjectsto work, that are not explicitly saved in any of the Component'sSerialized Fields. Select Component Dependencies would not detect them, so you will have to select them manually.- An example would be Dynamic Bones, that uses the chain of
GameObjectsunder its rootTransform. - Another example is
Particle Systemcomponent, that depends on aParticle System Renderercomponent located in the sameGameObject.
- An example would be Dynamic Bones, that uses the chain of
- The tool provides 2 types of visualizations so you can locate the
Componentsto copy more easily: List View and Hierarchy View.