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.

  • \$\begingroup\$ i didnt see that post so thats why posting it over here. \$\endgroup\$ – Maaz Irfan Sep 21 '17 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 '17 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 '17 at 13:51
  • \$\begingroup\$ thanks for your suggestion @pikalek will definitely follow it. \$\endgroup\$ – Maaz Irfan Sep 26 '17 at 9:50

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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.