I've got one script which references the scripts within two objects.
The script is supposed to take each bone in the first object, change it based on the variable in the script, and then change it again based on a variable of the same name in another script. It then parents the bone of the first object to the same bone of the second object.
This script has been a bit butchered, but it might help visualize a bit.
How can I reference the variables by their names? Or perhaps there is another way to do this?
void tailor(GameObject Equip, GameObject Target) {
Equipment equipmentData = Equip.GetComponent<Equipment>();
Character characterData = Target.GetComponent<Character>();
foreach (Transform bone in Equip) {
string boneName = bone.name;
bone.localScale = (bone.localScale / equipmentData.boneName.localScale);
bone.localScale = (bone.localScale * characterData.boneName.localScale);
bone.parent = Target.bone;
bone.localPosition = Vector3.zero;
bone.localRotation = Target.bone.rotation;
}
}