Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
0
Question by veddycent · Nov 10, 2017 at 03:29 PM · scripting problemcullinglodgroup

How do you change the LODGroup Culled percentage via script

HI all,

How do you change the LODGroup Culled percentage via scripting (c#)

I can create an LODGroup and populate with geometry and set the percentage for the different LOD levels but I have no idea how you change the Culled percentage.

I cannot find anything in the documents either :/

Any help would be much appreciated

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

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by veddycent · Nov 12, 2017 at 06:52 PM

I have read through the documentation (https://docs.unity3d.com/ScriptReference/LODGroup.SetLODs.html) but there is no mention of it there.

It seams odd that you can't set it via code.

Thanks

Comment
Add comment · 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
0

Answer by jterry · Apr 10, 2018 at 05:34 PM

Hey veddcent, did you ever figure this out? I'm needing to do the same thing and can't find a way to set to culled.

Comment
Add comment · Show 2 · 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 veddycent · Apr 10, 2018 at 06:02 PM 0
Share

From memory you set the percentage for the last group to 0.

I'm not at my desk so cant confirm but if that's not it I'll check later.

avatar image veddycent · Apr 13, 2018 at 10:15 AM 0
Share

@jterry did you get this to work?

A few more points: If you do not set the last LODGroup percentage to 0 then it will default to the built in culled group (i.e. nothing will render) but if you set you last LODGroup (i.e. LOD2) percentage to 0 then the culled group will no longer be there.

Did that make sense?

avatar image
0

Answer by GXMark · Aug 23, 2018 at 10:16 PM

The way i set the cull percentage of the LODGroup is as follows:

I have 100% 66% 33% and want n% for cull

Lets say you want a 5% cull

so 100 x 1 / 20 = 5

if you want 10% cull

100 x 1 / 10 = 10, therefore [ LOD(1f / 10f, renderers); ]

                 LODGroup lodGroup = go.GetComponent<LODGroup>();
                 LOD[] lods = lodGroup.GetLODs();
                 Renderer[] renderers = new Renderer[1];
                 renderers[0] = meshRenderer[0];
                 lods[lods.Length - 1] = new LOD(1f / 20f, renderers);
                 lodGroup.SetLODs(lods);
                 lodGroup.RecalculateBounds();
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 purpl3grape · Mar 18, 2021 at 05:41 AM 0
Share

Thank you for providing more documentation on this ever than in the official docs.

avatar image
0

Answer by TaehoonYoon · Sep 18, 2020 at 06:33 AM

I can turn on LOD 1 immediately by using this code.

             LOD[] lods = lodGroup.GetLODs();
             // turn on LOD 1 immediately.
             lods[0].screenRelativeTransitionHeight = 1f;
             lods[1].screenRelativeTransitionHeight = 0f;
             lodGroup.SetLODs(lods);
Comment
Add comment · 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
0

Answer by Ava42 · Dec 26, 2021 at 05:44 PM

I was searching it too, but then I found this:

 LODGroup a;
 a.ForceLOD(index);

so it can work even better in my case if I want override LOD sometimes. it also have set pass <0 to return it do default processing.

Comment
Add comment · 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

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

176 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 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 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 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 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 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 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 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 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 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

Problem with my script 0 Answers

Javascript - Generic List question 0 Answers

Player won't stop moving when key is released 1 Answer

Half of the scripts functionalities not working in Android 1 Answer

How can I make a C# sharp script execute in a certain order? 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