Ran into a bit of a snag
I’m trying to get the prefab of the gameObject I currently have selected and then also the path of the prefab.
target is my selection
Im editing a script that another guy made.
This does give me the name of the gameObject I have selected.
(Component)target).gameObject.name
UnityEngine.Object GameObject2 = PrefabUtility.GetCorrespondingObjectFromSource(PrefabUtility.GetPrefabInstanceHandle((Component)target));
string prefabPath = AssetDatabase.GetAssetPath(GameObject2);
Debug.Log("Path: " + prefabPath);