How to add script to objects through Empty Child? (or other easier ways)

Hey guys. I’m a beginner to unity and while making my game I got stuck on one part. I have a few object spheres and cubes in a empty child and i want to rotate/spin them all together. Rather than adding individual scripts to each of them, is it possible to add a script to empty child or is there a better solution altogether. Thank you.,

Hi @Pantaa001

that mostly depends if you want to spin them around a common pivot/center, or each around themselves.

  • Common center: Use a parent empty gameobject, add all your spehres/cubes, and rotate the parent. All child objects will be rotated with the parent GO, keeping their own offsets from the center
  • Individual centers: Use the script on each of the objects

Hope that helps

Hello @pantaa001 ,

You can create an another empty game object and create one master/global script which will have one list of Target game objects. Write a business logic to rotate a gameObject and assign all those empty objects in that list.

Hope that works!!