Runtime Listener
v1.0
Runtime Listeners are components you'll add to objects that you want to be affected by the Color Sampler. The components you'll add are actually classes which inherit from the same RuntimeListener
parent class.
Create your own RuntimeListener
class
RuntimeListener
classYour game is unique, and you may have situations where you'd like to use the sampled color in a way that isn't available out of the box.
It's very easy to create your own class which inherits from RuntimeListener
. Check out each of the scripts below to see the methods they override -- not too many at all!
By creating your own classes, you can add functionality unique to your game.
UI Images / Raw Image - RuntimeColorListenerImage
RuntimeColorListenerImage
Attach this listener to any object with a UI Image
or a RawImage
component. It will apply the color to that image.
Material - RuntimeColorListenerMaterial
RuntimeColorListenerMaterial
Attach this listener to any object with a Material that accepts color values. The code uses material.color = colorValue;
so any material must have a color field, such as the Standard Shader.
If your material is a custom one and has a slightly different field, you can create your own Runtime Listener which inherits from RuntimeColorListenerMaterial
, and override the SetColorInstant()
method, as this is the method where the color is set.
Camera Background - RuntimeColorListenerCameraBackground
RuntimeColorListenerCameraBackground
Attach this listener to any object with a Camera
component, and the backgroundColor
field will be set to the output of the RuntimeColorSettings
object you choose.
Text Mesh Pro Text - RuntimeColorListenerTMPText
RuntimeColorListenerTMPText
Attach this listener to an object that has a Text Mesh Pro Text
component. The text color will be set for you.
Last updated