-2
\$\begingroup\$

I created a prefab that contains a trail renderer to draw a sprite in the GUI which I in a GameObject in a script.

I want to change the start width or end width of the trail renderer dynamically during run time. Could anyone help me how write code to access to the trail renderer prefab to change that property?

\$\endgroup\$
  • 1
    \$\begingroup\$ What have you tried with the code? What do you have so far? What's not working about it? \$\endgroup\$ – MichaelHouse May 4 '15 at 2:51
0
\$\begingroup\$

I have no experience with Unity, so I will make a few assumptions:

  1. You tried to make a TrailRenderer, but don't know "how to change trail renderer start width dynamically by script in unity?".
  2. So far, you have a TrailRenderer, but don't know "how to change trail renderer start width dynamically by script in unity?".
  3. The TrailRenderer that you have so far is working, but you don't know "how to change trail renderer start width dynamically by script in unity?".

I had to Google "Trail Renderer Unity" to see if that was a Unity thing or a class you'd created. Here are the first two links that Google returns:

Link to the manual page: manual reference
Link to the scripting page: script reference

endWidth and startWidth are listed right after the first entry on the script reference page and should allow you to achieve what you want.

\$\endgroup\$

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.