private ShapeController createShapeController(Sprite shapeSprite) { GameObject newShape = GameObject.Instantiate(ShapeTemplate, ShapeTemplate.transform.position, canvas.transform.rotation); newShape.transform.SetParent(canvas.transform, false); newShape.SetActive(true); Image image = newShape.GetComponent <Image>(); image.sprite = shapeSprite; ShapeController controller = newShape.AddComponent <ShapeController>(); canvas.AddShape(controller); return(controller); }
public void AddShape(ShapeController shape) { shapes.Add(shape); ChangeSelectedShape(shapes.Count - 1); }