Home c# Turn the object in Unity

Turn the object in Unity




You need to turn the object in the Unity. In inspector, it can be seen that it is turned around, but this is not noticeable in the camera display, i.e. The material does not rotate with the object. In the code, I first assign the material to the object, and only then turn the following code:

obj.transform.rotation = quaternion.euler (0, 90 * k, 0);

where k is a random number from 0 to 3

Then I tried through:

obj.transform.rotate (0, 90 * k, 0);

But the result is the same

Answer 1

I decided the problem. It turned out that the code is working, and it is necessary only in the object in Inspector to open Static and remove the checkbox there from the BatchTIC component. Everything has earned.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions