Verse Library verse

01 Fragment

Changes a UI widget color by modifying material scalar parameters on elimination.

verse-library/material-editor-ui/01-fragment.verse

# This is a simplified concept. In real Verse, you'd bind this to a Tracker.
# When EliminationCount > 0, we set the Material Parameter.

On_Elimination(Trigger: TrackerDevice, Player: Player):
    # Get the UI Widget (Rectangle)
    AlertBox := Get_UI_Widget("AlertRectangle")
    
    # Get the Material Instance attached to it
    MatInstance := AlertBox.Get_Material_Instance()
    
    # Set the Red parameter to 1.0 (Full Red)
    # This is like turning up the volume on the "Red" ingredient
    MatInstance.Set_Scalar_Parameter("BaseColor_R", 1.0)
    
    # Set Green and Blue to 0.0
    MatInstance.Set_Scalar_Parameter("BaseColor_G", 0.0)
    MatInstance.Set_Scalar_Parameter("BaseColor_B", 0.0)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in