---
tags:
    - "Effect"
---

# Set Trail Renderer Start Color

[Effects](../index.md) / [Trail Renderer](index.md) / **Set Trail Renderer Start Color**

## Description

Sets the Start Color property of Trail Renderer component

## Parameters

| Name | Description |
| :--- | :---------- |
| Trail Renderer |  |
| Value |  |

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Trail Renderer Start Color")]
    [Category("Effects/Trail Renderer/Start Color")]
    [Description("Sets the Start Color property of Trail Renderer component")]
    
    [Image(typeof(IconTrailRenderer), ColorTheme.Type.Blue, typeof(BadgeEye))]
    [Keywords("Effect")]
    
    [Parameter("Trail Renderer")]
    [Parameter("Value")]
    
    [Serializable]
    public class GenInstructionColor_TrailRenderer_SetStartColor : Instruction
    {
        [SerializeField] private GetGameObject m_TrailRenderer = new GetGameObject(
            new GenTypeGameObject_TrailRenderer()
        );
        
        [SerializeField] private GetColor m_Value = new GetColor();
        
        [SerializeField] private TweenTransition m_Transition = new TweenTransition();
        
        [NonSerialized] private bool m_IsComplete;
        
        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Start Color");
            return $"{this.m_TrailRenderer} {member} = {this.m_Value}{this.m_Transition}";
        }
        
        protected override async Awaitable Run(Args args)
        {
            TrailRenderer component = this.m_TrailRenderer.Get<TrailRenderer>(args);
            if (component == null) return;
            
            bool wait = this.m_Transition.Await;
            this.m_IsComplete = false;
            
            TweenManager.Run(new TweenInstanceInput<Color>(
                component,
                "startColor",
                component.startColor,
                (Color) this.m_Value.Get(args),
                this.OnUpdate,
                wait ? this.OnFinish : null,
                this.m_Transition.GetDuration(args),
                this.m_Transition.EaseMode,
                this.m_Transition.TimeMode
            ));
            
            if (wait) await this.Until(this.IsComplete);
        }
        
        private void OnUpdate(Component component, Color value)
        {
            if (component is not TrailRenderer componentTrailRenderer) return;
            componentTrailRenderer.startColor = value;
        }
        
        private void OnFinish() => this.m_IsComplete = true;
        
        private bool IsComplete() => this.m_IsComplete;
    }
}


```

