-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IObjectResolver.Instantiate() makes prefab dirty. #662
Comments
|
I would like to bump this one! It caused issues when I used RegisterComponentInNewPrefab to instantiate a prefab in a package that is included via the Unity Package Manager. All package files are read only, so every time the project was run in Editor, the prefab was marked as dirty and threw errors when saving the project. |
I think a better, and simpler approach will be to get the prefab's initial dirty state using EditorUtility.IsDirty and if it's not, clear the flag later using EditorUtility.ClearDirty That way we don't need to create a temporary parent and changing the parent later |
I created a PR using @AlonTalmi's idea. |
If I instantiate prefab with
IObjectResolver.Instantiate()
, the prefab show up in my VCS without any changes.Yes, when I stage them, they are gone but its pretty annoying.
The reason is IObjectResolver.Instantiate() directly disable the prefab itself then Instantiate it. (maybe for calling
Inject
beforeAwake
?)Zenject Instantiate a prefab as a child of inactive GameObject rather than disable prefab itself. Link
The text was updated successfully, but these errors were encountered: