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.
More functionalities
- You can automatically select other
Components
referenced 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
Component
selected 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
Components
to destination. - Skip Matching components: won't modify existing
Components
in destination. - Matching paths Only: won't add unmatching/missing
GameObjects
to 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
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".
- Newly created
- The
GameObject
Tags
andHideFlags
properties are not copied when Copy From comes from anAssetBundle
Prefab
, loaded using FACS LoadBundle. - 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. 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
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 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 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
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, that uses 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.