public void SpawnUnit() { GameObject spawnedUnit = Instantiate(catPrefab, this.transform.position, Quaternion.identity); UnitBehavior spawnedUnitBehavior = spawnedUnit.GetComponent <UnitBehavior>(); spawnedUnitBehavior.MoveTo(this.transform.position + new Vector3(2, 0, 2)); }