Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
2
Question by raphu604 · Jul 28, 2013 at 11:12 PM · variableresolutionruntimeshadowquality settings

How can I change the shadow-resolutions property without having to increase or decrease quality level?

Now... I know this has been asked before, but NOBODY really got an actual answer to this.

Unity doesn't give me the variables for the quality settings for shadows quality (like soft, hard, soft+hard, shadow resolution etc...). So I thought I cheat by gathering all light sources of a scene with Object.FindObjectsOfType and change the shadow resolutions for every light in the scene. But I got trolled again (it doesn't exist for the Light class either).

 using UnityEngine;
 using System.Collections;
 
 public class ShadowsQuality : MonoBehaviour {
     
     public static int shadowsQualityLevel;
     private enum g_ShaowsQualityLevels {Low, Medium, High}
     private Light[] allLightSources;
 
     void Start () {
     
         allLightSources = Object.FindObjectsOfType(typeof(Light)) as Light[];
     }
     
     void Update () {
         
         switch(shadowsQualityLevel){
         case 0:
             foreach(Light lights in allLightSources){
                 lights.shadows = LightShadows.Hard;    
                 //WHERE IS THE SHADOWS RESOLUTION VARIABLE?!
             }
             break;
         case 1:
             foreach(Light lights in allLightSources){
                 lights.shadows = LightShadows.Soft;                
             }
             break;
         case 2:
             foreach(Light lights in allLightSources){
                 lights.shadows = LightShadows.Soft;                
             }
             break;            
         }
     
     }
 }

Does anybody know how I am supposed to change such an important setting from a script without having to switch between entire quality levels defined in the Inspector? I know that the Slender: The Arrival team made it somehow (you can customize every single setting in that game, from AA and AF to global shadows quality etc etc etc...).

It would be pathetic to make the users not be able to change the single settings and force them to switch between one global quality state (like, for example GRAPHICS: On/Off or GRAPHICS: Low, Medium, High XD).

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Benproductions1 · Jul 28, 2013 at 11:15 PM

Hello,

Simple answer: You can't. For some odd reason Unity does not allow you to change certain quality settings at runtime.

Here is a workaround: http://forum.unity3d.com/threads/182101-Enable-or-disable-shadows-and-set-shadow-quality-at-runtime

Hope this helps,
Benproductions1

Ps: Yes I found the answer through a google search :P

Comment
Add comment · Show 5 · 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 raphu604 · Jul 28, 2013 at 11:21 PM 0
Share

thanks for your answer, I feel a bit weird though. I didn't expect this from Unity. Now I have to do that painful painful painful workaround with over 9000 quality levels (each of those depending on the other settings of the user -.-, like shadows high + textures low, shadows medium + textures high, etc etc etc...)

avatar image Benproductions1 · Jul 28, 2013 at 11:24 PM 0
Share

It's not as bad as you think. $$anonymous$$ost quality settings are accessible from scripts. See this for all settings.

avatar image raphu604 · Jul 28, 2013 at 11:29 PM 0
Share

well but how should I proceed then? create quality levels for shadows = low + textures = high, shadows = medium + textures = high, etc etc etc... Are the vsync and texture settings applied then (through QualitySettings.vSyncCount etc...) even if I switch between all those quality levels?

avatar image Benproductions1 · Jul 28, 2013 at 11:53 PM 0
Share

Just have all the non-accessible quality settings as separate quality levels. Then when you change those, you just reapply any other custom settings.

avatar image raphu604 · Jul 28, 2013 at 11:58 PM 0
Share

Thank you a lot for your help. At least I know what I have to do now :)

avatar image
0

Answer by Eideren · Aug 30, 2015 at 05:56 PM

If you came here for a simple solution, there is none. This feature has been posted on the feedback page, you might want to vote on that so that it hopefully gets implemented : http://feedback.unity3d.com/suggestions/allow-shadow-quality-to-be-changed-at-runtime-via-scripts

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 AtticusMarkane · Jun 13, 2017 at 06:51 PM 0
Share

Light.shadowResolution was added for this: https://docs.unity3d.com/540/Documentation/ScriptReference/Light-shadowResolution.html

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Change Shadow type C# 1 Answer

Adjusting Unity scene for smartphones and tablets? 1 Answer

Controlling Shadow Resolution Quality in script? 2 Answers

Export objects to a .3DS file at runtime 1 Answer

Store a GameObject to a variable on runtime. 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