In my attempt to make an RTS game I have created a node system. Each node has a different node number so that way specific units know which one to go to. There is one original node(Goto) and then when the player right clicks a new node(NewGoto) is spawned. There is one serious problem though, the node numbers always stay at 1. Here is the code so I can explain more:
cloneScript = originalgoto.gameObject.GetComponent(NodePlacement); originalgoto = Instantiate(newgoto, transform.position, transform.rotation); cloneScript.nodeNum = nodeNum + 1; nodeNum = nodeNum + 1; originalgoto = newgoto;
I have been trying to base the node number off of the previous node number from the previous clone. All the nodes use the same script. To accomplish that I tried
originalgoto = newgoto;
but that did not work, and I am not sure what to do as I have not been able to find the answer. Any feedback is appreciated. Also if I did not explain well enough feel free to ask questions.