Durch Ziehen mit der Maus in C# UNITY3D?

Brauche ich einen Würfel zu bewegen durch klicken und ziehen mit der Maus in C# Unity3D. Mein code derzeit erstellt die Würfel mit der cilcking eine Schaltfläche.

using UnityEngine;
using System.Collections;

public class CDraggable : MonoBehaviour 
{
    Texture btnimg;

    //Use this for initialization
    void Start ()
    {
    }

    //Update is called once per frame
    Update () 
    {
        //here to write mousedrag code.
    }

    void OnGUI() 
    {
        if (GUI.Button(new Rect(400, 250, 50, 50), btnimg))
        {
            //Debug.Log("Clicked the button with an image");
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            cube.transform.position = new Vector3(-0.7F, 2, 0);
        }
    } 

}
  • Was haben Sie bisher ausprobiert? SO ist nicht in einem forum zu Fragen, andere tun Ihre Arbeit für Sie.
InformationsquelleAutor user2497684 | 2013-07-04
Schreibe einen Kommentar