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
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);