HI everyone, getting the following error code ‘backgroundCleaner.cs(5, 47): error CS1514: } expected site:forum.unity.com’
from the following script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class backgroundCleaner : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Background")
{
float widthOfObject = ((BoxCollider2D)collision).size.x;
Vector3 position = collision.transform.position;
position.x += widthOfObject * 1.99f;
collision.transform.position = position;
}
}
Can anybody see what I am doing wrong please? I am trying to make a screen cleaner for a side scrolling game. I want to put my backgrounds into a pool to recycle them (learning about preserving memory currently). Any help would be really appreciated. Cheers in advance guys & gals