I am working on laser defender, doing all that breese told me to, even used his own code when mine wasn’t working. With the enemy ships , I am trying to move them side by side, but the camera.ViewportToWorldPoint(new Vector3(0,0,distance)) x variable keeps staying at 0 when I do a print. This is not the case with the player ship… the player ships camera.ViewportToWorldPoint(new Vector3(0,0,distance)) does exactly as it should, it moves to the ends of the screen, but the enemy ships wont move because of the camera restraining the edges. Do you know why I have this problem?
2 days ago
for the moment I hardcoded the xmin and xmax and didn’t use camera.viewporttoWorldPoint and it is working, but I dont know why it works in player, and not in enemy spawn script
The code is
Camera.main.ViewportToWorldPoint (new Vector3 (0, 0, distance));
I think you forgot the word main
.