Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CutFruitOnClick : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- Debug.Log("START Hej fra cut fruit on click");
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetMouseButtonDown(0)) {
- Debug.Log("Venstre Museklik");
- Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
- RaycastHit hit;
- if (Physics.Raycast(ray, out hit, 100)) {
- if (hit.transform == this.transform) {
- GetComponent<ParticleSystem>().Emit(5);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement