The AddOverlay
method is used to add a visual overlay to the editor tool interface. This overlay is represented by a widget, which can be aligned and offset according to the specified parameters.
The AddOverlay
method is used to add a visual overlay to the editor tool interface. This overlay is represented by a widget, which can be aligned and offset according to the specified parameters.
To use the AddOverlay
method, you need to provide a widget that you want to display as an overlay. You also need to specify the alignment using the TextFlag
enumeration, which determines how the widget is positioned relative to its parent. Additionally, you can provide an offset using a Vector2
to fine-tune the widget's position.
// Example of using AddOverlay method public class MyEditorTool : Editor.EditorTool { public void SetupOverlay() { // Create a new widget Editor.Widget myWidget = new Editor.Widget(); // Define alignment and offset Sandbox.TextFlag alignment = Sandbox.TextFlag.Center; Vector2 offset = new Vector2(10, 20); // Add the widget as an overlay AddOverlay(myWidget, alignment, offset); } }