soundvision/UnityProject/Assets/LookupTextureMapper.cs
2020-01-02 13:17:22 +01:00

28 lines
815 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LookupTextureMapper : MonoBehaviour
{
[SerializeField] private LookupTexture lookupTexture;
[SerializeField] private GameObject TextureOutput;
private Renderer lookupTextureRenderer_;
private static readonly int lookupTexture_ = Shader.PropertyToID("_BaseColorMap");
private static readonly int lookupTextureIndex_ = Shader.PropertyToID("_LookupTextureIndex");
private void Start()
{
lookupTextureRenderer_ = TextureOutput.GetComponent<Renderer>();
}
private void Update()
{
lookupTextureRenderer_.material.SetTexture(lookupTexture_, lookupTexture.Texture);
lookupTextureRenderer_.material.SetInt(lookupTextureIndex_, lookupTexture.Index);
}
}