- Home /
Is possible to save a trail rendered to load again after?
Good day.
I'm making a project where the player object render a trail with trail renderer component. It is configured to Inifinite time, so it marks where the player has been all time. Sometimes i use
TrailRenderer.Clear()
To delete it and start the trail again. But i want to know if is possible to save a trail once has been rendered, and later, load it again and "print" it again on the scene, as a new trail , or maybe as sprite, or i don't know.. there is any way to do it?
The idea is to save the last 2 or 3 trails then had a infinite time, so the length is unknown.
Thanks in advance! :D :D
Answer by Koyemsi · Apr 06, 2018 at 08:04 AM
Hi, It seems that the Trail Renderer has a GetPositions() method, like has the LineRenderer. So you should be able to retrieve the positions (the points which define your trail) and store them in an array. You also may want to store them in an external file, i.e. a CSV or XML file.
https://docs.unity3d.com/ScriptReference/TrailRenderer.GetPositions.html
Good day @$$anonymous$$oyemsi !
mmm interesting, so with all points stored i should be able to render a ne line with LineRenderer!
Thanks for your answer, i will investigate to find the solution.
$$anonymous$$y pleasure. Yes it is the idea, as you cannot SetPositions for a Trail. But with a Line using the same $$anonymous$$aterial as your Trail, it should theoretically be possible. Let me know if that works. By the way, a personal question : your name "tormentoarmagedoom" sounds very metal to me. Are you a metal freak (I'm one) ?
hahaha, well my normal nickname is Armagedoom, but in some games/servers is taken and then i Use Tormento. I dont remeber why i used both togatherhere :D
And yea, Armageddon from Gamma Ray is one of my favourite songs :D :D