void Start() { int randMoney = Random.Range(0, 8); Vector3 moneyPos = transform.position; moneyPos.y += 0.5f; if (randMoney < 1) { GameObject moneyInstance = Instantiate(money, moneyPos, money.transform.rotation); moneyInstance.transform.SetParent(gameObject.transform); } int randMoney2 = Random.Range(0, 8); Vector3 money2Pos = transform.position; money2Pos.y += 0.5f; if (randMoney2 < 1) { GameObject money2Instance = Instantiate(money2, money2Pos, money2.transform.rotation); money2Instance.transform.SetParent(gameObject.transform); } if (money2Pos == moneyPos) { //where gameobject2s position should change } }
if (money2Pos == moneyPos) { //where gameobject2s position should change }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)