Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DemonGamesLab · Jun 26, 2016 at 06:02 AM · c#unity 5

rendersettings.skybox not working? c#

Ok so its a bit strange that render settings is not working, the main reason being is I have the exact same script in my other game and it works fine, its a simple script. basically what happens is if I write the script the skybox will just give the default blue, I have been at this for hours, I've read everything online and can not find out what's going on. the materials have been set in the inspector and everything checked and double checked.

I will write the script how I wrote it in Unity. public Material dayMat; public Material nightMat

void Update () { if (Clock.hours >= 5 || Clock.hours <= 21) { RenderSettings.skybox = dayMat; } else { RenderSettings.skybox = nightMat;

     }

}

all this does is return the default blue sky and very strange I have the same script in my other game?

does anyone have the same problem or know anything ? thanks in advance.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by pronobroy · Jun 26, 2016 at 09:33 AM

  public Material mat;
  public Material day;
  public Material skyBox;
    
 5.
  float t = 0.02f;
  float a;
  // Use this for initialization
  void Start ()
 10. {
         RenderSettings.skybox.Lerp(skyBox, mat, 0.5f);  //Here assaying mat matiral as default .
  }
  
  // Update is called once per frame
 15. void Update ()
  {
          a = (Time.time *4) % 360;
 
          transform.eulerAngles = new Vector3(transform.rotation.x + a , transform.rotation.y, transform.rotation.z);
 20.
        
          if(a > 25 && a < 150 )
          {
             //Changing default to day matiral skybox.
 25.             RenderSettings.skybox.Lerp(skyBox,day,0.5f * Time.deltaTime); 
          }
           
         else if (a > 150 && a < 185)
          {
 30.             //Changing day matiral to mat matiral
              RenderSettings.skybox.Lerp(skyBox,mat,0.5f*Time.deltaTime);
          }
  }



You can try this for changing skybox.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DemonGamesLab · Jun 26, 2016 at 12:02 PM 0
Share

Thank you for the answer pronobroy, but my script works in my other game and trying to figure out why its not working in my current one, but I will take some good pointers from this script, ill see what I can do with it :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Unity5 filled my SSD? 0 Answers

Generate floor mesh according to walls 0 Answers

Unity 5 - Adding a Pre-made Countdown Timer C# Script to the Game Scene as a Text UI Element 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges