It is necessary to make it so that when an object is spawned, it appears at a certain angle, which is constantly changing, but not accidental. When creating-destroying, I did
`for (int I = 0; i < 50; i++){ transform.position = new Vector3 (i+10, 0, transform.position.z) Instantiate(obj [Random.Range (0, obj.GetLength (0))], transform.position, transform.rotation );// появляется случайный объект в такой же позиции, как и раньше, под тем же углом, что и раньше (угол меняется в совсем другом месте) }` Here obj [] is an array consisting of a square with a rectangle. And when the square rotates, all subsequent squares appear at the same angle, but the rectangles do not (this should be so). But how to do the same, but from the pool? I removed the Instantiate line and wrote this:
GameObject newObject = theObjectPools[objectSelector].GetPooledObject ();// в этом пуле хранятся квадрат и прямоугольник newObject.transform.position = transform.position; // позиция появления квадрата или прямоугольника newObject.transform.rotation = transform.rotation; // угол их появления In the end, I can make all the objects appear spawn at some angle, but two problems: 1) all objects change the angle, but only squares are needed, 2) Quaternion does not accept float (I can’t tell him to have the same angle, like that square over there). How to make so that only the squares appear with the right angle?
Quaternionaccepts float, you just need to use eitherEulercoordinates (there is an option) or immediately work with habrahabr.ru/post/183908 - pavel