Access main camera from different GameObject script

I am making a scene editing utility, I have a GameObject which holds many textures that you can choose from to apply to prefabs, and I want to be able to place a line of 10 textured prefabs at the top of the screen using ViewportToWorldPoint in UnityScript.

I’ve tried everything I can find on the forum but I can’t reference the main active camera to find its coordinates, how do I reference it from the texture editing GameObject’s script?

Look at these:

Camera.current.ViewportToWorldPoint(Vector3.Zero);
// or
Camera.main.ViewportToWorldPoint(Vector3.Zero);

You can get the ViewportToWorldPoint information from two different ways in the Camera class:

Either with Camera.current or the Camera.main .

Read the documentation for the differences between those two.

Good luck!