Search Unity

Using a AssetModificationProcessor script to interrupt prefab saving

Discussion in 'Editor & General Support' started by VatelsRevenge, Aug 22, 2014.

  1. VatelsRevenge

    VatelsRevenge

    Joined:
    Feb 10, 2012
    Posts:
    14
    I want to prevent certain prefabs from being saved. AssetModificationProcessor Class Scripts appear to be the most reliable way to get this done. They handle Scene and Prefab modification (saving).

    Using the OnWillSaveAssets callback, I can return a null script[] value to prevent a scene from saving. But for prefabs, even though the OnWillSaveAssets gets called and code runs, the prefabs still "save" (apply changes).

    Why? The implied functionality is that this shouldn't be the case. That's like making OnClose run after SOME windows have already closed and the variables are no longer available. Just feels broken to me. If it is, can this be added to the list of bugs to be fixed?
     
  2. VatelsRevenge

    VatelsRevenge

    Joined:
    Feb 10, 2012
    Posts:
    14