U
U
umru_alone2021-08-25 13:16:47
C++ / C#
umru_alone, 2021-08-25 13:16:47

I'm making a game about pop it. It is necessary to make a script so that the pimples can be popped on both sides of the wheelbarrow. How can you do?

I'm new and don't know how to do it. Made the code to work on 1 side. I think whether it is possible through the animator or not?

here is the code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class ControllerPressing : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{   
    public Animation anim;
    public MeshCollider colliderdestroyed;
    
        
    public void Awake()
    {
        anim = GetComponent<Animation>();        
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        anim.Play();       
        MeshCollider.Destroy(colliderdestroyed);        
    }   
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-08-25
@tentrun

The count threw off, but what does not work? What do you need to do? A game for you?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question