Files
Continentis/Assets/OtherPlugins/Sprite Shaders Ultimate/Demo/Scripts/Demo_VectorFollow.cs

36 lines
780 B
C#
Raw Normal View History

2025-11-25 21:49:03 -05:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SpriteShadersUltimate.Demo
{
public class Demo_VectorFollow : MonoBehaviour
{
//Public:
public string propertyName;
public Transform trackedTransform;
//Internal:
Material mat;
void Start()
{
Renderer renderer = GetComponentInChildren<Renderer>();
if(renderer.sharedMaterial.name.EndsWith("(Instance)"))
{
mat = renderer.sharedMaterial;
}
else
{
mat = renderer.material;
}
}
void FixedUpdate()
{
mat.SetVector(propertyName, trackedTransform.position);
}
}
}