looping through objects

Hello folks,

I’m new to Unity and hope you can help me out with a few unclear things. I like physcis-based games alot and will be spicing up the built-in engine with my own physics scripts. To do this I need to somehow be able to leaf through all interacting objects / particles with a for…next loop. For instance, I’m implementing a planetary gravitational interaction script, which makes all objects of my choice act according to Newtons laws. I’ve got all the physics up and running, I’m just not sure how to do the actual looping-through. Any help will be appreciated!

Cheers,
Mike

Hi, Mike - welcome to the forum!

If you can put all objects of a particular type inside a parent object, then you can loop through the children using the Transform class (see the example right at the top of the Transform class doc page for details).