N
N
NoobNoob22021-08-06 16:37:22
C++ / C#
NoobNoob2, 2021-08-06 16:37:22

Invalid token = is class. struct, or interface member declaretion what to do?

I was writing the target code for the tower and this error appeared:
610d3ad1520fb343927018.png
Here is the code:

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

public class TowerTrigger : MonoBehaviour
{


    public Tower twr;

    public bool lockE;

    public GameObject curTarget;

    void OnTriggerEnter(Collider other)
    {

        if (other.CompareTag("enemyCube") && !lockE)
        {
            twr.target = other.gameObject.transform;
            curTarget = other.gameObject;
            lockE = true;
        }

    }

    void OnTriggerExit(Collider other)
    {
             if (other.CompareTag("enemyCube") && other.gameObject == curTarget) ;
    }       
              lockE = false;
            
}

help me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oleg_ods, 2021-08-06
@NoobNoob2

lockE=false;
need to move to the OnTriggerExit method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question