Ejemplo n.º 1
0
    public static TodoField Add(float x, float y)
    {
        TodoField obj = CreateInstanceEasy <TodoField>("TodoField", x, y);

        //MyCanvas.SetCanvasChild<TodoField>(obj);
        obj.transform.SetParent(MyCanvas.GetCanvas().transform, false);
        return(obj);
    }
Ejemplo n.º 2
0
    public static Type CreateCanvasInstance <Type>(string prefab_name, float x = 0, float y = 0) where Type : Token
    {
        GameObject prefab = null;

        prefab = Util.GetPrefab(prefab, prefab_name);
        Vector3    pos = new Vector3(x, y, 0);
        GameObject g   = Instantiate(prefab, pos, Quaternion.identity) as GameObject;

        g.transform.SetParent(MyCanvas.GetCanvas().transform, false);
        Type obj = g.GetComponent <Type> ();

        return(obj);
    }