I’ve been enjoying the course with it’s different approaches to the same problem but coming from Glitch Garden I’m getting tired of doing an activity to be told that it is not the correct way to do things… then redoing something. A lot of glitch garden was spent with me watching solutions to problems that I did not have in my game but felt I didn’t want to miss anything.
I was here in 3D now, where I belong… No interest in 2D but happy to do my apprenticeship to get the building blocks correct. I’m trying to script where I see redundancy in components linked here an there. I get some of the reasoning but I have my own.
Everything boiled over with me at the start of Bowl Master… I placed the pins accurately and was finally happy but Ben told me I had to rip it all up to add rigid bodies and I will not! I stand my ground here!
Now I wanted to just loop through the children of the pins blank object and add the bodies in script but all my “Elegant” ideas were thrown away with errors. Can anyone show me a better solution? Should I be sticking to gui components linked (I did a lot of the Glitch stuff scripted this way and had no issues, I was going to script the pins rather than place them but was enjoying messing about in 3D for the first time).
I
private GameObject pinsParent;
// Use this for initialization
void Start () {
pinsParent = GameObject.Find("Pins");
AddRigidBody (pinsParent.transform);
}
private void AddRigidBody(Transform parentPassed)
{
foreach (Transform child in parentPassed) {
child.gameObject.AddComponent<Rigidbody>();
}
}