Home › Page › UghPublisher

UghPublisher

Inherits from Script

UghPublisher is the workhorse of Ugh.  A typical usage will inherit from this class and provide various callback functions for events defined in the editor inspector.

See the UghPublisher tutorial for more details on how to use this class.

Variables
name type description
transformReferences TransformReference[] Array of transform references
transforms TransformDictionary Dictionary of transforms
ughTextReferences UghTextReference[] Array of UghText references
ughTexts UghTextsDictionary Dictionary of UghTexts
ughButtonReferences UghButtonReference[] Array of UghButton references
ughButtons UghButtonsDictionary Dictionary of UghButtons
ughSlideToggleReferences UghSlideToggleReference[] Array of UghSlideToggle references
ughSlideToggles UghSlideToggleDictionary Dictionary of UghSlideToggles
ughSliderReferences UghSliderReference[] Array of UghSlider references
ughSliders UghSliderDictionary Dictionary of UghSliders
Functions
name type description
GetButton UghButton Returns the UghButton given a name.
GetSprite UghSprite Returns an UghSprite given a name.
OnButtonPressed void Triggers the publisher callback for the given UghButton.

_

Using UghPublisher in Script

public UghSprite GetSprite(string name)
public UghButton GetButton(string name)

These two functions are used to find an UghButton or UghSprite.  They are largely superseded by the ughButtons and transforms dictionaries, and are provided for backwards compatibility.

public void OnButtonPressed(UghButton button)

This function triggers the assigned callback function for a given UghButton.  This is used by the internal logic to trigger callback functions, but can also be useful to simulate button clicks for debug or automation purposes.