Vote count:
0
I have some objects that have positions. I'd like to shuffle the objects' positions. (ie, take all the positions, shuffle, and reassign for each object).
This is what I have, but I'd like something more elegant (in 1 line).
var i = 0;
var tags = transform.FindChild("Step 1").Cast<Transform>().Where(t => t.name.StartsWith("Tag")).ToList();
var newPosition = tags.Select(t => t.position).OrderBy(t => Random.Range(0, 3)).ToArray();
tags.ForEach(t => t.position = newPosition[i++]);
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire