---
tags:
    - "Rotation"
    - "Euler"
    - "Angles"
    - "Pitch"
    - "Yaw"
    - "Roll"
    - "Text"
    - "Convert"
---

# Quaternion

[Quaternion](index.md) / **Quaternion**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The Euler angles of a rotation in the specified string format

## Parameters

| Name | Description |
| :--- | :---------- |
| Rotation | The rotation value converted to text as its Euler angles |
| Format | The numeric format specifier used for each axis. 'F2' if left empty |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Quaternion")]
    [Category("Quaternion/Quaternion")]

    [Description("The Euler angles of a rotation in the specified string format")]
    [Image(typeof(IconQuaternion), ColorTheme.Type.Lime)]

    [Parameter("Rotation", "The rotation value converted to text as its Euler angles")]
    [Parameter("Format", "The numeric format specifier used for each axis. 'F2' if left empty")]

    [Keywords("Rotation", "Euler", "Angles", "Pitch", "Yaw", "Roll", "Text", "Convert")]

    [Serializable]
    public class TypeStringQuaternionGet : TypeString
    {
        private const string FORMAT = "F2";

        [SerializeField] private GetQuaternion m_Rotation = new GetQuaternion();
        [SerializeField] private string m_Format = FORMAT;

        public override string GetPreview(GameObject source) => Format(
            this.m_Rotation.GetPreview(source),
            this.m_Format
        );

        public override string Get(Args args) => Format(this.m_Rotation.Get(args), this.m_Format);

        private static string Format(Quaternion rotation, string format)
        {
            return rotation.eulerAngles.ToString(string.IsNullOrEmpty(format) ? FORMAT : format);
        }

        public override string ToString()
        {
            return this.m_Rotation.ToString();
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

