I want to duplicate an object by a certain (integer) amount and move it by that x-0.2 (so the first one would be -0.2, second would be -0.4, third would be -0.6). When I try to do this I get the error "Cannot modify the return value of 'Transform.position' because it is not a variable". My code:
public GameObject object;
// Start is called before the first frame update
void Awake()
{
GameObject[] clones = null;
for (int i = 0; i < GameManager.singleton.currentLevel; i++)
{
clones[i] = GameObject.Instantiate(object);
clones[i].transform.position.y = -0.2 * (i + 1);
}
}
Thanks in advance!