Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code:
- public Texture2D Texture;
- public static string TexturePath = Application.dataPath + "/color.png";
- //Application.dataPath for rust is \Steam\steamapps\common\Rust\RustClient_Data\
- private void Start()
- {
- //Load texture
- if (File.Exists(TexturePath))
- {
- byte[] Bytes = File.ReadAllBytes(TexturePath);
- Texture = new Texture2D(200, 200);
- Texture.LoadImage(Bytes);
- }
- }
- public void BoxRect(float x, float y, float w, float h)
- {
- if (Texture != null)
- {
- GUI.DrawTexture(new Rect(x, y, w, h), (Texture)Texture);
- }
- }
- public void Box(float x, float y, float w, float h, float thick)
- {
- BoxRect(x, y, w, thick);
- BoxRect(x, y, thick, h);
- BoxRect(x + w, y, thick, h);
- BoxRect(x, y + h, w + thick, thick);
- }
- private void OnGUI()
- {
- Box(100.0f, 100.0f, 50.0f, 100.0f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement