Editor Script Changes On Prefab Don T Persist Unity Engine Unity

Editor Script Changes On Prefab Don T Persist Unity Engine Unity You need to make use of undo.recordobject and or editorutility.setdirty or serializedobject to make sure your changes are persisted. you have to call this function to tell unity that you like to record the changes made to a specific prefab instance. how to correctly save changes to a prefab done by a editor script?. From 5.3 onwards, with the introduction of multi scene editing, this function should no longer be used for modifying objects in scenes. instead, you should use undo.recordobject prior to making changes to the object. this will mark the object's scene as dirty and provide an undo entry in the editor.''.

Editor Script In Prefab Isolation Mode Doesn T Save Changes To Child Even if i put the prefab in the scene, modify and save, all the changes still gets lost. i’ve noticed that if i enable “debug” mode on the inspector (and so all of the parameters are shown as though as it had no custom editor) the changes does get saved. Note: if one doesn't close bug editor window and reopens the scene, prefab keeps saved values. if one calls editorutility.setdirty at the end of the script, it also keeps expected values, however, in documentation it is written that editorutility.setdirty is only suitable for non scene objects. I’ve found that the current prefab experimental build has an issue when adding a component to a prefab through script. I’m currently making an in editor tool that is creating, parenting, deleting children inside a prefab. but no matter what method i call before or after editing my object, changes are lost when i quit the prefab mode.

Custom Editor Window Does Not Show Prefab Overrides Questions I’ve found that the current prefab experimental build has an issue when adding a component to a prefab through script. I’m currently making an in editor tool that is creating, parenting, deleting children inside a prefab. but no matter what method i call before or after editing my object, changes are lost when i quit the prefab mode. Looks to me like recordprefabinstancepropertymodifications only records the changes made to that instance (so when you reload the scene, the changes persist). if you want to change the prefab asset itself, try prefabutility.applyprefabinstance. This works fine when manually change the value of prefab instance. but when i do it using a editor script, it do not turn bold and the property value changes to the source prefab when i play the game. here is an example of the code: using unityengine; using unityeditor; [customeditor(typeof(testscript))] public class editor : editor {. Instantiating prefabs with editor script is breaking the prefab connection. i’m working on an architechural visualization type project and using instantiate in an editor script to populate the world with objects exported from my cad model, (wrote export script for cad). the majority of my “game…. A script we write to process assets and modify them does not correctly save in certain cases, and i believe this to be when they contain nested prefabs. i need to run the script multiple times for it to then process everything correctly and save the changes.
Comments are closed.