Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
11 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 Dalek.skaro · Jul 22, 2015 at 04:55 AM · shaderrenderqueue

How do i change the Render Queue ?

I was having problems whith the rendering order of two transparent materials and i was advised to set the render queue of the object in question (a spaceship shield) to Transparent+1, since they are both probably currently set to Transparent. HOW DO I MAKE THIS MODIFICATION ???

(apparently it has to do with the Unity ShaderLab, and i dont know anything about it).

Here is the inicial question: http://answers.unity3d.com/questions/996834/how-do-i-correct-the-rendering-order-of-two-transp.html

Comment
Add comment · Show 1
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 getyour411 · Jul 22, 2015 at 05:38 AM 0
Share

http://docs.unity3d.com/$$anonymous$$anual/SL-SubShaderTags.html

4 Replies

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

Answer by CHPedersen · Jul 22, 2015 at 06:11 AM

You can do it with shaders by changing the Queue tag in the subshader tags list, indeed. See link posted by getyour411 for the documentation on that.

But there's an easier way, if you're not comfortable working with shader code. It's possible to override the render queue number from scripts instead. Use Material.renderQueue, for example like this:

     renderer.material.renderQueue = 3001;

Notice that 3001 is the same as "Transparent+1" in a shader, because the string "Transparent" in shaderlab is actually just a placeholder for the number 3000. All transparent objects have renderQueue numbers equal to or greater than 3000.

Comment
Add comment · Show 3 · 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 AndyP-123 · Oct 26, 2016 at 07:32 AM 0
Share

If you don't set the render queue value in script, It's worth noting that if you set the it in the shader after creating a material, the existing value in materials using the shader will not be updated unless you edit them in a text editor or in the debug inspector, since it's not a parameter that is exposed via the UI normally.

https://docs.unity3d.com/ScriptReference/$$anonymous$$aterial-renderQueue.html "Note that once render queue is set on the material, it stays at that value, even if shader is later changed to be different."

avatar image tanoshimi AndyP-123 · Oct 26, 2016 at 07:40 AM 0
Share

If you set the render queue to -1 in the debug inspector, it will always use the queue specified in the shader, not the "cached" queue from when the material was created.

avatar image Acreates · May 25, 2017 at 02:31 AM 0
Share

Awesome! For us non engineers, can you provide the script? Thank you.

avatar image
0

Answer by Acreates · May 25, 2017 at 07:11 AM

Awesome! For us non engineers, can you provide the script? Thank you.

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 felix_of_mars · Jul 16, 2017 at 02:41 PM

This doesn't work, as soon as you enter the play mode it resets back to Transparent as the default.

Comment
Add comment · Show 3 · 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 javiolvecal · May 16, 2020 at 02:21 PM 0
Share

Thats because you write the code in the Start method, if you write it in the Update method, Unity will adjust the renderQueue to the value that you wrote every frame . You can also write:

  [ExecuteInEdit$$anonymous$$ode]  

If you write it over the script name line, Unity will execute the code in the editor, and you will see that the renderQueue changes in the editor too.

avatar image felix_of_mars · May 16, 2020 at 02:35 PM 0
Share

I forget why I needed that, but writing it in the update seems not very optimal.

avatar image javiolvecal felix_of_mars · May 20, 2020 at 09:31 PM 0
Share

In a game that has very high graphics and an advanced AI it will not be optimal, but in a simple game that don't requires a lot, it will not make problems

avatar image
0

Answer by Fattie · Aug 02, 2020 at 10:44 PM

I found that you CAN actually just set the custom render queue in the editor,


alt text


but it's simply flakey.


In current Unity, you sort of have to set it and then quickly press Play (regardless of what scene you're in or whatever), and then it does seem to "stick" from there on.


Just another Unity hassle! Hope it helps someone.


screen-shot-2020-08-02-at-54159-pm.png (7.5 kB)
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

7 People are following this question.

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

Related Questions

Sprite behind semi transparent mesh 0 Answers

Vertex/Fragment shaders - transparency ignoring Render Queue 3 Answers

GPU instancing breaks when setting RenderQueue through script. 1 Answer

Changing Queue in shader has no effect 1 Answer

Standard Shader Still Visible through Stencil Shader 0 Answers


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