What do you want to save?
Add Code snippet
New code examples
-
Other 2022-01-30 11:30:22
Raycasting to find mouseclick on Object in unity 2d games
RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if(hit.collider != null) { Debug.Log ("Target Position: " + hit.collider.gameObject.transform.position); } Add solution -
Other 2021-10-28 13:59:13
how to make a dragable object in unity2D
using UnityEngine; using System.Collections; [RequireComponent(typeof(BoxCollider))] public class Drag : MonoBehaviour { private Vector3 screenPoint; private Vector3 offset; void OnMouseDown() { offset = gameObject.transform.position - C... Add solution
Best helpers
Davidw20
+5
Herman Deep
+5
Ornello
+5
Fogwright
+5
Rob Deary
+5
Jonny Five
+5
Vaishnavi
+5
Dan Nestor
+5