Yes, it is quite possible to remove transitions or otherwise alter the graph in runtime.
Here is an example code to remove all transitions from a graph assigned to a GraphOwner:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
usingUnityEngine;
usingNodeCanvas.Framework;
publicclassRemoveTransitions:MonoBehaviour{
voidStart(){
varowner=GetComponent<GraphOwner>();
vargraph=owner.graph;
foreach(varnode ingraph.allNodes){
foreach(varconnection innode.outConnections.ToArray()){//must use .ToArray()
graph.RemoveConnection(connection);
}
}
}
}
Let me know if that works for you.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.