Skip to content

Color Switcher

eisclimber edited this page Feb 25, 2024 · 3 revisions

Color Switcher

class in ExPresSXR.Misc / Extends MonoBehavior
Component added via Component Menu

Description

Switches the Material/Color of a GameObject between the original material and an alternative Material.

Optionally the material switches can be performed for a set amount of time and then switched back or simply be toggled.

Members

Public Properties

  • Material alternativeMaterial: The material that is replacing the material applied to the GameObject via Editor.
  • float switchDuration: The duration the material is switched when calling the '...ForSwitchDuration' functions.
  • bool requireOriginalMaterialMatch: When changing to the Original Material, the object's material must be the Alternative Material.
  • bool requireAlternativeMaterialMatch: When changing to the Alternative Material, the object's material must be the Original Material.

Public Methods

  • void ActivateAlternativeMaterial(): Activates the alternativeMaterial.
  • void ActivateOriginalMaterial(): Activates the original Material.
  • void ToggleMaterial(): Activates the current Material.
  • void ActivateAlternativeMaterialForASecond(): Activates the alternativeMaterial for a second.
  • void ActivateOriginalMaterialForASecond(): Activates the original Material for a second.
  • void ToggleMaterialForASecond(): Toggles the current material for a second.
  • void ActivateAlternativeMaterialForSwitchDuration(): Activates the alternativeMaterial for the duration of switchDuration.
  • void ActivateOriginalMaterialForSwitchDuration(): Activates the original Material for the duration of switchDuration.
  • void ToggleMaterialForSwitchDuration(): Toggles the current Material for the duration of switchDuration.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally