Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

The Unity of small science

As always, here are some popular science tips from Unity:

  • Unity is a real-time 3D interactive content creation and operation platform.
  • All creators, including game development, art, architecture, car design, film and television, use Unity to bring their ideas to life.
  • The Unity platform offers a comprehensive suite of software solutions for creating, operating and monetizing any real-time interactive 2D and 3D content on mobile, tablet, PC, game console, augmented reality and virtual reality devices.
  • You can also simply think of Unity as a game engine that can be used to make professional games!

Learn Unity

Conversion between Unity quaternion and Euler Angle

1. Quaternions are converted to Euler angles

Vector3 v3=transform.rotation.eulerAngles;
Copy the code

2. Quaternions are transformed into direction vectors

Vector3 vector3= (transform.rotation * Vector3.forward).normalized;
Copy the code

3. Euler Angle is converted to quaternion

Quaternion rotation = Quaternion.Euler(vector3);
Copy the code

4. Euler Angle is converted into direction vector

Vector3 v3 = (Quaternion.Euler(vector3) * Vector3.forward).normalized;
Copy the code

5. Convert direction vector to quaternion

Quaternion rotation =Quaternion.LookRotation(vector3);
Copy the code

6. Convert the direction vector to euler Angle

 Vector3 v3 =Quaternion.LookRotation(vector3).eulerAngles;
Copy the code

A way to activate/deactivate a gameobject using code in Unity

Deactivating a game object in Unity is as simple as unchecking the one shown below in the properties panelMethods to deactivate/activate using code:

    void Start()
    {
        // Activate a gameobject
        gameObject.SetActive(true);

        // Deactivate a gameobject
        gameObject.SetActive(true);
    }
Copy the code

What if UnityHub prompts that the license has expired?

While working with Unity, we often get a hint that you don’t have a valid license

As shown below:Don’t panic, just click on the one on the rightAdministrative license

Then click Activate LicenseThen select from the window that pops upUnity Personal -> I don't use Unity in a professional capacity

Click Finish and wait for a whileAfter completion, the following screen will appear, indicating that the activation is successfulAppear this kind ofLicense expirationIt’s because we didn’t pay for Unity to use it professionally

The Mainland Chinese version of Unity was prone to this problem, with licenses being updated almost every day

But some time ago, it seems that there is no need to update, relax the policy can be directly used!

If you encounter direct update it is good, the above can also choose manual update, but more trouble, in this article so direct activation is good!