- Home /
Question by
13dnizinski · Dec 30, 2013 at 03:02 AM ·
gameobjectlistcopyelement
When I add a gameObject from one list to another, it makes a new one instead of referring to the same one?
I have a two lists. Variable 'openList' is a list of my own type 'AINode,' and blockList is a list of GameObjects. Whenever I try to add a blockList element, It copies the gameObject in blockList. I wanted to simply refer to the same GameObject instead of making a copy. This is the code I'm using:
openList.Add( new AINode(new Vector3(curPos.x,0,curPos.z), blockList[(int)(curPos.x+1)][(int)(curPos.z)][1]) );
//Any help is greatly appreciated :D
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613125123im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to see what element is the current one 2 Answers
How to make changes to a copied object 1 Answer
Get first gameobject in a list and cycle through on keypress 1 Answer
How to remove objects from a list ? 3 Answers