Hi,
Im very new to Editor scripting and getting stuck on selecting components by name.
I want to be able to run a tool thatll apply scripts to different bones, meshes etc of a rig. based on the naming conventions of that component.
I seem to be able to assign scripts to new gameobjects and selected gameobjects, but what I need is a tool that will look thru my character hierarchy and apply a scripts to named components. I assume this is possible(?)
this script is me trying to apply a single script to named components ‘thing’ (and failing)
using UnityEngine;
using UnityEditor;
public class CharFaceRig : ScriptableWizard
{
[MenuItem("My Tools/Create FaceRig Wizard...")]
static void CreateWizard()
{
ScriptableWizard.DisplayWizard<CharFaceRig>("Create Character", "Create new", "Update selected");
}
void OnWizardCreate()
{
string[] guids1 = AssetDatabase.FindAssets("name:thing");
foreach (string guid1 in guids1)
{
GameObject obj = Selection.activeGameObject;
Character characterComponent = obj.AddComponent<Character>();
}
}
}
thanks