- Home /
Question by
sebastiankloch_baltoro · Nov 19, 2020 at 02:30 PM ·
inspectorprefabs
Can't select base of Prefab Variant or any greyed out field in a inspector. 2019.4.13f1.
I recently updated my project from 2019.4.2f1 to 2019.4.13f1. Since the update I no longer can select greyed out fields like "Script" field or "Base" of prefab variant. or
Usually after clicking on such field in a "Project" window, an asset would be shown, but since update clicking on fields does nothing.
Unability to select bases of variants is the most painful.
zrzut-ekranu-2020-11-19-151756.png
(6.0 kB)
zrzut-ekranu-2020-11-19-151941.png
(7.5 kB)
Comment
Answer by sebastiankloch_baltoro · Nov 19, 2020 at 03:10 PM
Workaround for selecting a base. Create new script in an "Editor" folder and paste this code to it. After right clicking on any prefab variant, button in "Tools" should appear .
using UnityEditor;
public class PrefabsMenuItem
{
[MenuItem("Assets/Tools/Show Base of Prefab Variant", priority = 18)]
public static void PingBaseOfPrefabVariant()
{
GameObject[] gameObjects = Selection.GetFiltered<GameObject>(SelectionMode.Assets);
GameObject baseOfPrefab = PrefabUtility.GetCorrespondingObjectFromSource(gameObjects[0]);
EditorGUIUtility.PingObject(baseOfPrefab);
}
[MenuItem("Assets/Tools/Show Base of Prefab Variant", priority = 18, validate = true)]
public static bool PingBaseOfPrefabVariantValidate()
{
GameObject[] gameObjects = Selection.GetFiltered<GameObject>(SelectionMode.Assets);
return gameObjects.Length > 0 && PrefabUtility.GetPrefabAssetType(gameObjects[0]) == PrefabAssetType.Variant;
}
}