Deleting Nodes
Jungle has strict rules for deleting node scripts due to limitations with the Unity asset database system. In Jungle, node instances are stored as sub-objects of tree instances. If a node’s script file is deleted outside Unity, the database won’t detect the change, leaving the node instances without valid script references.
This issue doesn’t cause functional problems but clutters the tree’s asset file, and Unity won’t let you remove the broken nodes. To address this, Jungle’s cleanup systems archive the node’s metadata, allowing recovery if the script file is reimported.
To avoid future headaches and confusion, it’s recommended to use the following methods.
There are two options for deleting node scripts.
- The easiest but most destructive method is to delete the script file via the Unity Editor’s Assets window.
- A safer, non-destructive alternative is to deprecate the node by setting the deprecated flag in the node options.
The best method for you is totally up to you. In cases where multiple people work on the same project, option two is likely best.
Deprecate Node Scripts​
Safest and most recommended approach.
Jungle is very strict about deleting node scripts. This is due to limitations with the Unity Asset Database and how it handles sub-assets. Jungle has safeguards in place to prevent nodes from losing metadata and serialized data when nodes go missing or are deleted via the file system.
If you delete a node script from your file system, Jungle cannot detect the change and will not be able to perform important cleanup on your trees. This can create a ton of issues and is NEVER recommended.
There are two options for deleting nodes:
Marking the Node as Deprecated​
The NodeProperties
attribute has a Deprecated
property that can be set to true
. This will mark the node as
deprecated and will remove it from the explorer and mark all instances of the node in the validator.
Steps
- Open the node script in your code editor.
- Add the
Deprecated
property to theNodeProperties
attribute and set it totrue
.
using Jungle;
[NodeProperties(
Title = "My Node",
// ↓↓↓↓↓↓↓↓↓↓ ↓↓↓↓
Deprecated = true
)]
public class MyNode : IdentityNode
...
Deleting the Node via Assets Window​
Nodes can also be deleted like any other asset in Unity. This method is safe but is irreversible. If any instances of the node being deleted are found in any trees, Jungle will display a warning dialog to confirm the deletion.
Steps
- Locate the node script in the Assets window.
- Then you can either:
- Press the
Delete
key on your keyboard while the node script is selected. - Right-click the node script and select
Delete
from the context menu.
- Press the
This method is IRREVERSIBLE and will permanently remove all instances of the deleted node from all trees. All connections, metadata, and serialized data will be lost.