Hey,
I saw in this post how to make a Prefab in a CustomEditor script.
My question is how do I add a component that I get in a ObjectField to a Prefab ?
var Script = EditorGUILayout.ObjectField(Script, typeof(Object), true); //get the script
var tempGO = new GameObject();
// add a script to it
var tempComponent = tempGO.AddComponent(Script) // <--- I'm looking for something like this
// give the script the values from input (note: values on the script needs to be public)
tempComponent.someValue = someInputValue;
tempComponent.someValue2 = someInputValue2;
// create an empty prefab in project
var emptyPrefab = PrefabUtility.CreateEmptyPrefab(full path to save including prefab name);
// replace the gameobject with the empty prefab (save)
PrefabUtility.ReplacePrefab(tempGO, emptyPrefab);