How can i size and place the plane according to the screen size ?

Hello,

I have done similar thing using GUI.DrawTexture

Here is my code
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), textureToDisplay);

But i want to achieve the same using a plane.

Guide me please !

Screen.width
Screen.hieght

can you elaborate, lets say i have a plane in my scene, here is the image-


i have attached a script to it, now can u guide me the exact line of code ?? i tried my best on everything but to no success

You can give the dimension of the screen via these commands. Get the dimensions and apply it to you plane in the manner you see fit.

it didnt worked for me, i have tried for hours,thats why i am asking you to give me the exact line of code, i’ll add ur code to the script attached to that plane

No you can’t. Screen.height and Screen.width are read only. Had you actually read the documentation you linked to you would have known that.

What you need to do is individually place the 4 vertices of the plane by transforming screen space into world space. This and this should help you do that.

i am little confused on how to use both of these ?? i am sooooory. Please point me to arrange a line of code…i am confused like how do i go about it

If this confuses you, perhaps you should try mastering, understanding simpler items.

Said the person who couldn’t even provide meaningful documentation…

So you need to place 4 points. (0, 0), (0, Screen.height), (Screen.width, 0), and (Screen.width, Screen.height) but you need to place them in world space because that’s what the plane understands. The Z component of the world space vector is distance from the camera. So use Camera.ScreenToWorldPoint with the above X,Y combinations using a Z to determine distance from the camera. That will give you 4 world space Vector3’s representing the 4 corners of the screen. You can use these to build your mesh or place the vertices of an existing mesh - whatever you like.