我需要通過單擊並拖動C#Unity3D來移動多維數據集。我的代碼目前通過按一個按鈕來創建多維數據集。鼠標在C#UNITY3D中拖動?
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);
}
}
}
你到目前爲止試過了什麼? SO不是你要求別人爲你做你的工作的論壇。 –