Trying to battle this one out as EditorUtility.IsPersistent(go) is now obsolete to check if we are dealing with a prefab asset or prefab instance.
so, within a script attached to a prefab that we are editing using the new prefab workflow, that is within its own scene. How can we know we are editing a prefab? since now, it’s actually an instance of the prefab we are editing.
currently the only way I found is by querying the .scene of the gameobject and if the scene name is the same as the gameobject name and the scene path is empty then that must mean this is the prefab source. But that is not very clean.
Hi, the API still seems to be experimental in 2019.3 (Unity - Scripting API: PrefabStage).
Any news on when and where it will finally land?
I am currently detecting whether the user is in PrafbStage or not with the code below, but it seems a bit risky to put this into production (AssetStore asset) since the API location may change.
Ping Knowing this is pretty important for editor tool. I’ve tried various workarounds to avoid using the experimental PrefabStageUtility but I couldn’t find a system that works in 100% of the cases.
My “resolution” was to just keep using the experimental namespace until it breaks, which has not happened to me yet. It is also in the latest version: 2020.1, so I don’t think it will go away soon.
In my opinion an API which has been existing unchanged for three major releases (2018, 2019, 2020) is no longer experimental. I understand that the reason for not changing it is probably backwards compatibility, but being experimental for so long defeats the purpose of the namespace imo.
It would be nice to have some kind of newsletter where you can sign up and get notified if something breaks in the namespace/classes which you have signed up for. I know it’s a big wish, but that would spare me to check which versions of unity are breaking my code (at least API wise). This could be automated too. Just scan for API changes in releases/docs and send the emails.
The are a lot of changes to the API in 2020.1; for example PrefabStage inherits from a different class. However, it’s mostly backwards compatible. We wanted to get it out of experimental API for 2020.1 but due to issues with the API updater and various build and test infrastructure, it hasn’t been possible. It’s actively being worked on though. The API, once out of experimental, will be the same as in 2020.1, just moved out of experimental. The API updater should handle almost all cases of this automatically.