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 /
This question was closed Sep 24, 2017 at 07:06 AM by tyfoon3s for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by tyfoon3s · Sep 22, 2017 at 02:48 AM · 3drenderinglayerstrail renderer

[SOLVED]Multiple Trail Renderers not sorting properly. Help ?

Hey guys, I was making an asssignment ( drawing game ) with Trail Renderers. I have a single script to generate it wherever the user touches the screen ( all this works well ), but I have a script that changes it's color ( Material - Sprite/Default) to either of 4 colors using butttons. However when I draw it, I get it like this example Actually in this, I drew the red line in the last but it's at the bottom. Is there a way I can make the Trail Renderer draw over the former one no matter what the color is ? I mean how do I overlap it ? Thanks .

alt text

error1.png (20.4 kB)
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

  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Sep 22, 2017 at 11:46 AM

Uhm at what "depth" do you draw your lines? Do you really use a TrailRenderer or a LineRenderer? TrailRenderers do disappear automatically.

If you use LineRenderers you can use localspace coordinates instead and then you can place the line renderers in the z position you like in case you want to reorder them. However simply moving each new line slightly closer to the camera will make it draw on top of all others.

If you want to use worldspace coordinates (which is the default) you would need to specify the depth directly in all the positions you generate.

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 tyfoon3s · Sep 22, 2017 at 12:44 PM 0
Share

I use Trail Renderers with infinite disappearance time, what do I do ?

avatar image Bunny83 tyfoon3s · Sep 22, 2017 at 12:55 PM 0
Share

Well, using a trail renderer that way is possible but may has some additional overhead as the trail renderer has to check every frame if it has to extend itself.

Though the same thing applies to the trail renderer. It's a 3d component. So just set an appropriate z value when you're moving it around. It wouldn't make much sense to post an example since it might be something completely different of what you're currently doing. Can you post your drawing code?

avatar image tyfoon3s Bunny83 · Sep 22, 2017 at 03:51 PM 0
Share

Here is the Update Function snippet https://hastebin.com/enidiyajaw.cs

Show more comments
avatar image
1

Answer by hexagonius · Sep 22, 2017 at 08:50 AM

A linerenderer makes use of one or more materials. It uses a certain queue, most likely 3000 for transparency in your case. I guess you're using the same material despite the color change, which means its 3000 for all of them, and therefore in arbitrary order to be rendered. You can adjust the queue by changing the materials renderqueue to accending values (3001, 3002...)

https://docs.unity3d.com/ScriptReference/Material-renderQueue.html

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 tyfoon3s · Sep 22, 2017 at 11:21 AM 0
Share

That kinda fixed it, but now the ones with lower render queue values go under the higher ones, how do I fix it such that every line overlaps or crosses OVER the previous one no matter what it's material or render queue is ?

avatar image hexagonius tyfoon3s · Sep 22, 2017 at 08:50 PM 0
Share

first of all, sorry, it wasn't 2000, it was 3000. Second, you mean like real painting? Why don't you texture paint then?

Follow this Question

Answers Answers and Comments

79 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

Related Questions

Put Post Processing Only On Certain Layer 0 Answers

Make 2D sprites adjust layers based on distance in a 3D World 0 Answers

TrailRenderer renders infinitely long, even though time is set to 1f 1 Answer

Using URP how to make sprites lit by 3D Lights again? 6 Answers

Trail rendering order 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