VRCEUiButton - AtiLion/VRCMenuUtils GitHub Wiki

VRCEUiButton Docs

Requires The VRChat.UI namespace

Table of Contents

VRCEUiButton(string name, Vector2 position, string text, Transform parent = null)

Creates a new button, positions it and sets it for you.

Parameters

  • name - The name of the button gameobject(needs to be unique)
  • position - The position of the button relative to the parent(use in hundreds)
  • text - The text inside of the button
  • parent - The button's parent gameobject.
VRCEUiButton button = new VRCEUiButton("btnTest",  new Vector2(0f, 0f), "Test Button", userMenu);

VRCMenuUtils Properties

bool Success

Returns true if the component has been successfully created.

Unity Objects

Transform Control

Returns the root Transform of the component.

Transform ButtonControl

Returns the Transform that contains the Button.

Transform ImageControl

Returns the Transform that contains the Image.

Transform TextControl

Returns the Transform that contains the Text.

RectTransform Position

Returns the position of the component.

UI Objects

Button ButtonObject

Returns the Button instance of the component.

Text TextObject

Returns the Text instance of the component.

Component Properties

string Text

The text inside of the button.

Note: You can use this for both getting and setting the text

Component Events

Action OnClick

Executed when the button is clicked.

VRCEUiButton button = new VRCEUiButton("btnTest",  new Vector2(0f, 0f), "Test Button");

button.OnClick += () {
	// Code
};