- Home /
How to get the objects inside another object and put them in a array?
Im making a 3D fps game called "Tactical Warfare" And right now im trying to add attachments, but i need to find gameobjects that are in another gameobject and put the in an array.
heres my current script im trying to do it and primarySightsPath is a Transform.
if(Input.GetKeyDown("j")){
primarySightsPath = GameObject.Find(primaryGunObj.name + "Gun Animation Parent/Attachments/Slider/Sights").transform;
for(var attach : Transform in primarySightsPath){
primarySights.Push("attach.gameObject");
}
}
What errors are you getting? Which data type is primarySights
?
Hey dude thx for commenting but I figured out a better way of doing attachments that I have got in my game,and the changes will be in my games next update Allso if any one wants me to show them how I did it and what cod I used just leave a comment and I'll upload the code.
No problem, please post an answer and select it, so others won't open this answer to help. :)
Answer by Lt.ven0mI · Oct 07, 2013 at 03:17 PM
I figured out a better way of doing a attachments system but if any one wants me to show them the code just leave a comment or something.
Your answer
Follow this Question
Related Questions
transform.find and Instantiate do not return the same type? 1 Answer
Which is faster, GameObject.Find or GameObject.FindWIthTag? 2 Answers
Search for specific entity in an array? 1 Answer
FindClosestEnemy() change target? 1 Answer
How do I instantiate same tag/name GameObjects with an array 1 Answer