0
\$\begingroup\$

How can I achieve effect shown on picture below with use of Trail Renderer in 2D game? Is it even possible? I need dotted (dashed) trail behind my object and i can't figure it out.

dotted trail don't know why stack can't load my images LINK HERE


Why trail renderer? Because I feel this is the right way to do this. Earlier, (Unity ver 5.3) I achieved this using: Mesh Particle Emitter + Particle Animator (Fade) + Particle Renderer, but sometimes it behaves strangely in multiplayer. Particles not always came out from object, sometimes they were offset. Anyway, Unity in ver. 5.5 released new component (TrailRenderer), which I would like to use (if it is possible to accomplish effect I need).

I am looking for efficient ways, so answers like "you can instantiate"dot" every X sec. at position of your moving object" ... Please no.

What I have tried.

I added to my gameobject a child (gameobject) with Trail Renderer. Then I put material into Materials array field.

Material shader currently is set to Mobile/Particles/Additive (I am targeting Mobile devices). Material Texture is:



don't know why stack can't load my images LINK HERE


I've tried different settings to accomplish my needs but with no success.

Trail Renderer -> Texture Mode -> Tile (my gameobject is followed by one dot and line)

Texture Import- > Wrap mode -> Repeat (my gameobject pulls dots without gaps behind instead leaving dots in place it was)

Also i tried different shaders, different Trail Renderer parameters with no success. Most of time, my gameobject is followed by stretched dot, line or dots without gaps which are pulled instead of left in place where object was.

\$\endgroup\$
1
\$\begingroup\$

Here's the effect:

enter image description here

And here's the setup:

enter image description here

Texture on the shader is just a blurred dot made in photoshop. Here it is:

Texture (it's really there, but it's white)

enter image description here

Attach this particle system to an empty Gameobject and make the Gameobject a child of your moving object. You can play with Emission and it's Rate over time to make the trail more 'filled'. Also, you can play with Start lifetime to make the trail longer. Change the Color over lifetime to make it disappear eariler, or fade-in/out these dots.

You can try to change the texture to anything else - it'll work.

And yes - it's efficient. 10 small objects with a Mobile/Blend shader won't really affect any device. Even if you spawn 10k of these. Maybe 5k :>

\$\endgroup\$
  • \$\begingroup\$ Thanks for your reply. I have not tested it yet but I am sure it will work as expected. Do you think that it's posibble to achieve the same effect with use of Trail Renderer? What is the purpose of this module? On this website link they show some trail effects generated by Trial Renderer and there is dotted trail too link. \$\endgroup\$ – meshuffle Jun 1 '17 at 16:47
  • \$\begingroup\$ You can use TrailRenderer too. Here's a search result: stewartimel.com/blog/2016/03/04/simple-star-dust-trail-in-unity \$\endgroup\$ – Jacob Jun 1 '17 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.