Advertisement
Guest User

ddd

a guest
Aug 2nd, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Code:
  2. public Texture2D Texture;
  3. public static string TexturePath = Application.dataPath + "/color.png";
  4.  
  5. //Application.dataPath for rust is \Steam\steamapps\common\Rust\RustClient_Data\
  6.  
  7. private void Start()
  8. {
  9. //Load texture
  10. if (File.Exists(TexturePath))
  11. {
  12. byte[] Bytes = File.ReadAllBytes(TexturePath);
  13. Texture = new Texture2D(200, 200);
  14. Texture.LoadImage(Bytes);
  15. }
  16. }
  17.  
  18. public void BoxRect(float x, float y, float w, float h)
  19. {
  20. if (Texture != null)
  21. {
  22. GUI.DrawTexture(new Rect(x, y, w, h), (Texture)Texture);
  23. }
  24. }
  25.  
  26. public void Box(float x, float y, float w, float h, float thick)
  27. {
  28. BoxRect(x, y, w, thick);
  29. BoxRect(x, y, thick, h);
  30. BoxRect(x + w, y, thick, h);
  31. BoxRect(x, y + h, w + thick, thick);
  32. }
  33.  
  34. private void OnGUI()
  35. {
  36. Box(100.0f, 100.0f, 50.0f, 100.0f);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement