Created
March 24, 2022 06:59
-
-
Save shivaduke28/87bc3a79cd9311274e7e73641e8fce4f to your computer and use it in GitHub Desktop.
GamingLight for Kanikama
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UdonSharp; | |
using UnityEngine; | |
public class GamingLight : UdonSharpBehaviour | |
{ | |
[SerializeField] Renderer[] renderers; | |
[SerializeField] float intensity; | |
[SerializeField] float speed; | |
private void LateUpdate() | |
{ | |
for(var i = 0; i< renderers.Length; i++) | |
{ | |
var h = (float)i / renderers.Length + Time.time * speed; | |
var c = Color.HSVToRGB(h % 1, 1, 1); | |
renderers[i].material.SetVector("_EmissionColor", c.linear * intensity); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment