I need to remove the (clone) from an initiated object’s name. I have tried:
Vector3 traderLocation = new Vector3(-6, 0, 0);
Instantiate(traderDood, traderLocation, Quaternion.identity);
traderDood.name = "Trader";
with no success, the object still spawns as “Trader(clone)”
The reason I need to do this is I have another script that references a float from the object named “Trader” (only one will be active at any given time). I tried searching for object by tag but I get the error that it doesn’t know what GetComponent is when using FindGameObjectsWithTag(“Traders”). - Traders is the tag while Trader is the name of the object spawning.
payment = GameObject.Find("Trader").GetComponent<Trade>().cost;
total = GameObject.Find("Trader").GetComponent<Trade>().amount;