A dashed line as trail
Hello, I want to create a trail which is a dashed line with a specific length and faded out at the end. The object I would like to attach the trail to is only moving in straight lines. See the attached picture to get an idea of what I would like to do.

Do you guys have a idea how to do it?
I've been trying to achieve this too with trail renderer however it seems like it just makes the material follow the sprite ins$$anonymous$$d of leaving it behind. It would be great to also make it work for object that are also not going in a straight line.
Answer by Major_Lag · Jan 19, 2020 at 05:42 AM
I just made my own. Attach to whatever you want the effect on.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class DashedTrailEffect : MonoBehaviour
 {
     float timeBtwSpawns;
     public float startTimeBtwSpawns;
     public float deleteAfterSeconds;
 
     public GameObject dash;
 
     private void FixedUpdate()
     {
         if (timeBtwSpawns <= 0)
         {
             GameObject line = Instantiate(dash, transform.position, transform.rotation);
             Destroy(line, deleteAfterSeconds);
             timeBtwSpawns = startTimeBtwSpawns;
         }
         else
         {
             timeBtwSpawns -= Time.deltaTime;
         }
     }
 }
 
              Your answer
 
             Follow this Question
Related Questions
Camera is making trail in moving objects 0 Answers
Particle Effect for Melee Attack 0 Answers
Why/How 2d tower of blocks collapse? 0 Answers