When I try to make an extra condition on my if statement using a public bool from another script, I get Assets\PipeMiddleScript.cs(22,151): error CS1513: } expected. Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PipeMiddleScript : MonoBehaviour
{
public LogicScript logic;
// Start is called before the first frame update
void Start()
{
logic = GameObject.FindGameObjectWithTag("Logic").GetComponent();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.GetType().ToString().Equals("UnityEngine.CircleCollider2D") && collision.gameObject.layer == 3 && logic.bool.gameIsOver == false) // This is where the error is
{
logic.addScore(1);
}
}
}
↧