LineRendererComponent

Draws a line and provides the ability to set the properties of the line.

# Properties

[{"index":"float Flexibility (Sync)","0":"Adjusts the width of the bending part. It is applied when IsFlexible is true."}]

[{"index":"boolean IgnoreMapLayerCheck (Sync)","0":"Does not perform automatic substitution when the Map Layer's name is specified in SortingLayer."}]

[{"index":"boolean IsFlexible (Sync)","0":"Sets whether to draw the bending part continuously or separately."}]

[{"index":"boolean IsSmooth (Sync)","0":"Draws a smooth curve if true, draws a sharp line if false."}]

[{"index":"boolean Loop (Sync)","0":"If true, a closed line will be drawn automatically connecting the start and end points."}]

[{"index":"string MaterialId (Sync)","0":"Specifies the Id of the material that the renderer will use."}]

[{"index":"int32 OrderInLayer (Sync)","0":"Determines the priority within the same Layer. A higher number indicates higher priority."}]

[{"index":"SyncList Points (Sync)","0":"The group of dots that form a line."}]

[{"index":"string SortingLayer (Sync)","0":"When two or more Entities overlap, the priority is determined according to the Sorting Layer."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"void ChangeMaterial(string materialId)","0":"Replaces the material to be applied to the renderer."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Events

[{"index":"OrderInLayerChangedEvent","0":"This event occurs when changing the Component's OrderInLayer."}]

[{"index":"SortingLayerChangedEvent","0":"This event occurs when changing the component's SortingLayer."}]

# Examples

The following is an example of drawing a circle around an entity.
    
    
    @Component
    script CircleDrawer extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
        self:DrawCircle(2, 20, Color.red, 1)
        end
    
        @ExecSpace("ServerOnly")
        method void DrawCircle(number radius, integer vertexNum, Color color, number width)
        -- radius: radius
        -- vertexNum: number of vertices
        -- color: line color
        -- width: line thickness
    
        if vertexNum < 3 then
        	log_error ("The \'vertexNum\' should be greater than or equal to 3.")
        	return
        end
    
        local lineRenderer = self.Entity.LineRendererComponent
        lineRenderer.Points:Clear()
        lineRenderer.Loop = true
    
        local delta = 360 / vertexNum
    
        for i = 0, vertexNum - 1 do
        	local theta = math.rad(90 + delta * i)
        	local position = Vector2(math.cos(theta), math.sin(theta)) * radius
    
        	local point = LinePoint(position, color, width)
    
        	lineRenderer.Points:Add(point)
        end
        end
    end
    

# SeeAlso

  * math
  * Vector2
  * [Draw Various Lines](/docs?postId=749)