Skip to main content

LiveDataDisplayView

A class in Root.Township, Alta.Utilities.Profiling.

Client: the on-screen debug readout (FPS and similar stats) on the player. Toggled by the DisplayFPS controller action for users with the debug_features permission.

Constructors​

MemberWhat it is
LiveDataDisplayView()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

11 private and internal fields
MemberWhat it is
private TextRenderer androidOnScreenTextText renderer used on Android.
private LiveDataDisplayCollection dataDisplaysThe set of data displays to run and show.
private string lastDisplayLast text shown, to skip unchanged updates.
private static readonly Logger loggerNLog logger.
private Text pcScreenTextUI text used on PC.
private PlayerController playerControllerThe player this view is on; found in a parent.
private readonly StringBuilder stringBuilderReused builder for the display text.
private float textUpdateIntervalSeconds between text refreshes.
private float textUpdateTimeTime since the last text refresh.
private float updateIntervalSeconds between data display updates.
private float updateTimeTime since the last data display update.

Methods​

MemberWhat it is
void ToggleFPSDisplay(PlayerInput controller = null)Turns the readout on or off, if Shift isn't held and the user has the debug_features permission.
10 private and internal methods
MemberWhat it is
private string GetText()Joins the output of every valid data display into one string, one per line.
private void OnDisable()Calls each data display's disable hook.
private void OnEnable()Calls each data display's enable hook.
private void RunDataAction(Action<LiveDataDisplayBase> action, Predicate<LiveDataDisplayBase> predicate = null)Runs an action on every data display that passes an optional filter; warns if no displays are set.
private void SetScreenText(string screenText)Shows text on the Android text renderer or the PC UI text, skipping it if unchanged.
private void SetScreenTextActive(bool active)Shows or hides the Android or PC text object.
private void Start()Hooks the left controller's DisplayFPS action and starts disabled with the text hidden.
private void Update()Updates the data displays and the shown text on their intervals.
private void UpdateDataDisplay()Rebuilds and shows the text every textUpdateInterval seconds.
private void UpdateDataInternals()Runs each valid data display's internal update every updateInterval seconds.

Used in​

Members of other types that take, return or hold a LiveDataDisplayView: