- Home /
Grouping objects in level editor
Hi everybody!
I'm making a level editor game, and one of the features I want to implement is an object grouping system, so that users can select several objects at the same time, and edit their position as a group, a bit like object parenting...
Currently, I am using this code for object selection:
var selectedObject : Transform;
function Update () {
if (Input.GetMouseButtonDown(0)) {
var hit : RaycastHit;
var ray : Ray = camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, hit)) {
selectedObject = hit.collider.gameObject.transform;
}
}
}
Now I need to know, how could I implement this object grouping system? I assume I would have to use some sort of array, but I have no idea how to use arrays with Transforms, and what other complications that might lead to. :/
Thanks in advance!
I would go learn all your scripting basics before taking on something of that scale. It will be near impossible otherwise.
You'll want to know:
-Basic vars: int, float, string, class, struct, enum, etc.
-Loops: for, while, do while.
-Conditionals: if, else, switch.
-Containers: arrays, lists, dictionaries etc.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075901im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Saving Transform Array 0 Answers
Movement on roads issue 1 Answer
How do I check the distance between multiples objects in an array from the player? 4 Answers
How to assign random positions to gameobjects from an array? 2 Answers
Cycle through an array? Have Camera Follow different Targets. 1 Answer