Forum rules - please read before posting.

Object: Replace Action reports "Destroying assets is not permitted to avoid data loss"

edited November 2015 in Technical Q&A
Hi,

In AC 1.49, I have an action list that uses Object: Add or Remove to Replace an in-scene GameObject (intact planks) with a prefab (broken planks). The prefab has a Constant ID saved with the prefab.

I don't recall whether the action list is Pause Gameplay or Run In Background.

Playing in the Unity 5.2.1p4 editor, the action reports:

Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate (theObject, true);
UnityEngine.Object:DestroyImmediate(Object)
AC.<ScheduleForDeletionCoroutine>c__Iterator10:MoveNext() (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:307)

My workaround was to use three actions:

1. Add (the prefab)
2. Teleport (move the prefab to the old object's position)
3. Remove (the old object)

Is there a better way to handle this?

(nixter on AC's Unity forum thread is also reporting the same issue with his project.)

Comments

  • What kind of ActionList was it, and how is it called?
  • Update: Never mind, found and fixed.

    Embarrasingly, the Action was trying to both add and remove the same object. This can be remedied by opening ActionInstantiate.cs, and modifying line 138:

    KickStarter.sceneSettings.ScheduleForDeletion (gameObject);

    to:


    KickStarter.sceneSettings.ScheduleForDeletion (replaceGameObject);
  • edited November 2015
    [EDIT: Just saw your post above. Thanks for the fix!]

    I have a scene object (FullPlanks) that has a ConstantID and is also saved as a prefab so I can reuse it. It has a hotspot with a Use interaction that runs an action list asset. 

    The action list asset runs in background. It has one action: Object: Add or remove (Replace). It replaces FullPlanks with BrokenPlanks.

    BrokenPlanks is a prefab with a ConstantID.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.