Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Assets/Duck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;

public class Duck : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{

}

// Update is called once per frame
void Update()
{
//we arent clicking on a UI element
if (EventSystem.current.IsPointerOverGameObject() == false) //this could be combined with the next if statement with &&, or just like this
{
//was there a click this frame?
if (Mouse.current.leftButton.wasPressedThisFrame)
{
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Mouse.current.position.ReadValue());
transform.position = mousePos;
}
}
//Y: set the position to be the mouse position in world space


}
}
2 changes: 2 additions & 0 deletions Assets/Duck.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading