| Property | Value |
|---|---|
| Id | UEA0011 |
| Category | Performance |
| Severity | Warning |
This is for both Material and Shader class methods. Both can be fixed by using Shader.PropertyToID() method.
class A : MonoBehaviour
{
Shader shader;
void Update()
{
shader.GetGlobalFloat("_Speed", 1f);
}
}class C : MonoBehaviour
{
Material material;
void Update()
{
material.SetVector("_WaveAndDistance", Vector3.one);
}
}using UnityEngine;
class A : MonoBehaviour
{
Shader shader;
int speedHash;
void Start()
{
speedHash = Shader.PropertyToID("_Speed");
}
void Update()
{
shader.GetGlobalFloat(speedHash, 1f);
}
}using UnityEngine;
class C : MonoBehaviour
{
Material material;
int waveAndDistanceHash;
void Start()
{
waveAndDistanceHash = Shader.PropertyToID("_WaveAndDistance");
}
void Update()
{
material.SetVector(waveAndDistanceHash, Vector3.one);
}
}