Hello,
I need to find all gameobjects in a cube area, i want to do this in an custom inspector though so i cant use any runtime methods.
Thanks in advance.
Update
.
The preferably the entire bounds of the objects should be checked agaisnt the area (if there is a way to do that) but if that isnt possible then just pivot point.
The cube is aligned to the global axis, not to any object.
This is pseudo code, I haven’t worked with C# in quite a while, but it should make sense as to what it does. Take a look, and if it doesn’t work, try and fix it ( cause that’s how you learn :)! )
using UnityEngine;
using System.Collections;
using System;
public class InsideOf : MonoBehavior
{
protected List<GameObject> insideMe = new List<GameObject>();
private void OnTriggerEnter(Collider e)
{
if(e typeof GameObject)
{
if(!this.insideMe.contains(e.gameObject))
{
this.insideMe.add(e.gameObject);
}
}
}
private void OnTriggerExit(Collider e)
{
if(e typeof GameObject)
{
if(this.insideMe.contains(e.gameObject))
{
this.insideMe.remove(e.gameObject);
}
}
}
}