Changing outline visuals at runtime is a common use case. For example, you might want to fade an outline in/out or change the width of the outline during the game.
Below you will find some example code that shows how you can do this.
The main thing is that you set a reference to your outline settings (FastOutlineSettings, SoftOutlineSettings, WideOutlineSettings, EdgeDetectionSettings or SurfaceFillSettings). Then, you have access to the outlines and their properties which you can modify.
The script below changes the color of the Wide Outline to a random whenever the spacebar is pressed.
using Linework.WideOutline;
using UnityEngine;
public class ChangeOutline : MonoBehaviour
{
[SerializeField] private WideOutlineSettings wideOutlineSettings;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
var color = new Color(
Random.Range(0.0f, 1.0f),
Random.Range(0.0f, 1.0f),
Random.Range(0.0f, 1.0f)
);
wideOutlineSettings.Outlines[0].color = color;
}
}
}