0
\$\begingroup\$

How to change or remove Skybox on run time in unity using C#?

Is there any way to remove it while its not even required?

Or load it using http link for material we are using in Skybox.

\$\endgroup\$
4
  • \$\begingroup\$ i didnt see that post so thats why posting it over here. \$\endgroup\$
    – Maaz Irfan
    Sep 21, 2017 at 12:28
  • 1
    \$\begingroup\$ @MaazIrfan I would recommend to delete it on stackoverflow. Unity is used almost only for game development, so the question fits better here. \$\endgroup\$
    – Philipp
    Sep 21, 2017 at 12:34
  • \$\begingroup\$ It's difficult to accept your claim of "i didnt see that post..." when it was posted from the same account. It was probably an honest mistake - own it, learn from it & move on to getting your question posted in the single SE site where it most belongs. \$\endgroup\$
    – Pikalek
    Sep 21, 2017 at 13:51
  • \$\begingroup\$ thanks for your suggestion @pikalek will definitely follow it. \$\endgroup\$
    – Maaz Irfan
    Sep 26, 2017 at 9:50

2 Answers 2

1
\$\begingroup\$

use this under any function if you want to remove for example in

void Update()
{ RenderSettings.skybox = (null);

or just use this RenderSetting.skybox = (null);

public material = skyboxMat;

to change skybox same RenderSetting.skybox = skyboxMat; is being used

\$\endgroup\$
0
\$\begingroup\$

In addition setting the skybox globally with RenderSettings.skybox = newMaterial, you can also set a skybox on the camera-level. This can be useful when you want to have different cameras with different skyboxes.

  1. Add a Skybox component to the camera game object
  2. Refer to it with GetComponent<Skybox>().material = newMaterial
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .