using System.Collections; using System.Collections.Generic; using UnityEngine; public class Ingredient : MonoBehaviour { // Start is called before the first frame update // L Vector3 mousePosition; new public Transform transform; public List IngredientIn; public int NutritionalValue; bool isMoving = false; //public GameObject table; private Transform DefaultTransform; void Start() { DefaultTransform = transform; //TODO pointer error } // Update is called once per frame void Update() { if (isMoving) { Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); transform.position = new Vector3 (mousePosition.x, mousePosition.y, transform.position.z); } ResetPosition(); } void OnMouseUp() { if (isMoving) isMoving = false; else isMoving = true; } public void ResetPosition() { transform.position = DefaultTransform.position; Debug.Log(gameObject.name); Debug.Log(transform.position); Debug.Log(DefaultTransform.position); } }