How To Create Custom Command To Group Selection In Unity Editor | Unity Tutorial

Опубликовано: 02 Март 2026
на канале: Devsplorer
877
17

This Unity tutorial covers how to create a custom command to group selected objects in Unity editor to use in edit mode.
While covering this main task, MenuItem and Selection classes are also briefly introduced/mentioned.
When CTRL+ G hotkey pressed, GameObjects are grouped by being child objects under a newly created GroupObject. This GroupObject is placed at the center position of the selected objects.

00:00 Intro & Demo
01:11 Warnings
02:00 Script
02:22 MenuItem Attribute
03:10 Command Logic
03:34 Validate Selection
04:27 Calculate Center Position
04:56 Group Objects
05:45 Last Validation
06:18 Outro

#Group #Selection #Command

#devlog
I had set out to group 3d eye parts modeled with Probuilder but did not want to merge them and I was too lazy to create parent objects to put grouped objects under it, then here we are 😄

If you want to see more of this kind of videos, please give this one a LIKE and SUBSCRIBE for future ones. Comments are always appreciated.
To Subscribe:    / @devsplorer  

Unity Docs MenuItem:
https://docs.unity3d.com/ScriptRefere...
Unity Docs Selection:
https://docs.unity3d.com/ScriptRefere...

If you are new here check out the CHANNEL TRAILER:
   • Welcome To Devsplorer | Game Dev Channel T...  

Confetti Particle System With Default Unity Assets | Unity Particle System Tutorial
   • Confetti Particle System With Default Unit...  
Divide Cubes Into Smaller Cubes Using Transform Functions In Unity | Tutorial
   • Divide Cubes Into Smaller Cubes Using Tran...  
How To Make Automatic Shooter In Unity | Spawn & Shoot With Physics | Tutorial | One Script
   • How To Create Auto Shooter In Unity | Unit...  
Simple Drag & Shoot mechanics developed with Unity,
   • How To Drag And Shoot 3D Objects in Unity ...  
SteamVR tutorials,
   • Unity SteamVR Setup For Unity 2019 | Unity...  

Here are some written tutorials https://devsplorer.wordpress.com/
I generally share sneak peeks of the next mechanics:
Twitter:   / eccegd  
Instagram:   / devsplorer  

Thanks for reading up to this point and see you in the next explorations :)
Have A Great Day!