- Home /
Other
Store Neighbors game Object in list.
i'm store ball into a list i do some code for this, but some ball can not store that Neighbors gameObject.
like: here in image 3 ball (A,B,C). B ball can store of C ball. C ball can store B ball but A ball can not be store B ball.
my code look like this
Answer by game4444 · Aug 29, 2017 at 12:56 PM
You didn't post your find_neighbour code. I think here required that code. Unable to get idea how you are finding neighbour. What i am thinking you can find neighbour using colliders. Like A,B,C balls are very closed to eachother. If we check in OnCollisionEnter or OnTriggerEnter. In these we can get neighbor object who would be colliding using collider information. It may be wrong but this is my idea.
$$anonymous$$y find_neighbour code has only Declaration of the List like:
public class Find_neighbour : $$anonymous$$onoBehaviour
{
public List<GameObject> same_bubble_list = new List<GameObject> ();
}
and this script i attach on every Instantiate GameObject.
Follow this Question
Related Questions
What data format should I store data in? 0 Answers
Data structure with 1 bilion possibilities but only around 200 actual objects 1 Answer
Data structure to efficently manage a queue of objects 2 Answers
Theory for individual skill based levelling system 0 Answers
Does Unity use hashmaps at run time for all parameters customized with string? 0 Answers