void CreateGoods() { GameObject goods = Instantiate(goodsPrefab); goods.transform.position = goodsSpot.transform.position; Vector3 targetPos = GameObject.FindGameObjectWithTag("resourcesMenu").GetComponent <ResourcesMenu>().woodSpot.transform.position; goods.GetComponent <Goods>().SetValueAndTargetPos(value, targetPos); if (currentWorker) { currentWorker.Act("stay"); goods.GetComponent <Goods>().currentWorker = currentWorker; } }