public CanvasImage AddImage(string name, Texture2D tex, Vector2 pos, Vector2 sz, Rect subSprite) { CanvasImage image = new CanvasImage(canvas, tex, position + pos, sz, subSprite); images.Add(name, image); return(image); }
public CanvasPanel(GameObject parent, Texture2D tex, Vector2 pos, Vector2 sz, Rect bgSubSection) { if (parent == null) { return; } if (sz.x == 0 || sz.y == 0) { size = new Vector2(bgSubSection.width, bgSubSection.height); } else { size = sz; } position = pos; canvas = parent; background = new CanvasImage(parent, tex, pos, sz, bgSubSection); active = false; }