Okay I thought I had this all figured out late last night, but coming back today I think I was dead wrong. And before you laugh at my script, I have only been doing my own scripting in C# for a little over a week. Anyway, I can’t figure out how to check whether or not an object is overlapping another object, and based on that either delete the object or mark it as instantiated in another script. So here’s the script:
using UnityEngine;
using System.Collections;
public class AfterInstantiation : MonoBehaviour {
private GameObject control;
private GameManager manager;
private bool overlapping = true;
void Start(){
if (!overlapping){
Destroy (gameObject);
}
else {
MarkAsInstantiated ();
}
}
void MarkAsInstantiated(){
control = GameObject.FindGameObjectWithTag ("Manager");
manager = control.GetComponent <GameManager> ();
GameManager.dungeonsExisting += 1;
}
bool Intersects(Bounds bounds){
overlapping = bounds;
}
}
This script only gave me one error, so I decided to show this one. This is the error I get, if it helps:
Assets/Scripts/Level Generators/Corridors and Rooms/AfterInstantiation.cs(28,17): error CS0428: Cannot convert method group Intersects' to non-delegate type
bool’. Consider using parentheses to invoke the method
I think the problem is I just don’t know how to call variables from other functions or something simple, but could anybody help me figure out what’s wrong with this script? Thank you in advance.