Example #1
0
    public static void Create()
    {
        if ( Selection.activeGameObject != null )
        {
            GameObject path = new GameObject ( "Path" );
            path.GetOrCreateComponent<PointPath> ();
            if ( Selection.activeGameObject.transform.parent != null )
                path.transform.parent = Selection.activeGameObject.transform.parent.transform;
            path.transform.position = Selection.activeGameObject.transform.position;

            PathFollower pathFollower = Selection.activeGameObject.GetOrCreateComponent<PathFollower> ();
            pathFollower.Path = path;
        }
    }
Example #2
0
    public static void CreateNinePatch()
    {
        GameObject go = new GameObject ();
        go.name = "NinePatch";

        /* NinePatch ninePatch = */ go.GetOrCreateComponent<NinePatch> ();

        if ( Selection.activeGameObject != null )
        {
            go.transform.parent = Selection.activeGameObject.transform;
            go.transform.position = Selection.activeGameObject.transform.position;
        }
        Selection.activeObject = go;
    }
Example #3
0
    public static void CreateQuad()
    {
        GameObject go = new GameObject ();
        go.name = "Quad";

        /* Quad quad = */ go.GetOrCreateComponent<Quad> ();

        if ( Selection.activeGameObject != null )
        {
            go.transform.parent = Selection.activeGameObject.transform;
            go.transform.position = Selection.activeGameObject.transform.position;
        }
        Selection.activeObject = go;
    }
Example #4
0
    public static void CreateTextMeshEx()
    {
        GameObject go = new GameObject();
        go.name = "Text";

        TextMeshEx textMesh = go.GetOrCreateComponent<TextMeshEx> ();
        textMesh.Font = Resources.GetBuiltinResource ( typeof ( Font ), "Arial.ttf" ) as Font;

        if ( Selection.activeGameObject != null )
        {
            go.transform.parent = Selection.activeGameObject.transform;
            go.transform.position = Selection.activeGameObject.transform.position;
        }
        Selection.activeObject = go;
    }
Example #5
0
    static void Create()
    {
        GameObject go = new GameObject ( "PolyMesh", typeof ( MeshFilter ), typeof ( MeshRenderer ) );
        PolyMesh polyMesh = go.AddComponent<PolyMesh> ();
        CreateSquare ( polyMesh, 10 );

        MeshRenderer renderer = go.GetOrCreateComponent<MeshRenderer> ();
        Shader shader = Shader.Find ( "Sprites/Default" );
        if ( shader != null )
        {
            Material material = new Material ( shader );
            material.name = "PolyMesh Material";
            material.SetColor ( "_Color", Color.gray );
            // material.hideFlags = HideFlags.DontSave;
            renderer.material = material;
        }

        if ( Selection.activeGameObject != null )
        {
            go.transform.parent = Selection.activeGameObject.transform;
            go.transform.position = Selection.activeGameObject.transform.position;
        }
        Selection.activeObject = go;
    }