Hello. I am currently writing a script in which the emission level of an object’s material will be dictated by a public variable that may be edited in the inspector via slider, once the player activates a trigger. However, I’m unable to correctly reference the emission level itself. The following is some code that I wrote up:
void OnTriggerEnter(Collider other)
{
if (other == Player)
{
targetObject.GetComponent<Material>().Emission = emissionIntensity;
source.PlayOneShot(activationSound, soundVolume);
}
}
Obviously, “.Emission” is not the correct reference to the emission level of a material. What would I replace this with so that this script works as it should?