How to use PrefabUtility.GetPrefabObject()

Hi dere,

I’m having a bit of trouble making use of PrefabUtility.GetPrefabObject(). Eventually I’m trying to get the result into a GameObject field. I’d like to avoid Instantiating the prefab (since I already have the instance I’m getting the prefab from!). Casting the returned object gives me an InvalidCastException. Is there a better way to get the GameObject for an instance’s prefab?

This has come up as a problem, again.

Am I doing it wrong?

prefab = (GameObject)PrefabUtility.GetPrefabObject(prop);