## Rename a member in Unity without losing the assignments in the Inspector

This is pretty simple when you have the right tag.

public GameObject m_foo;

To rename m_foo to m_bar without losing the assignments that have been set in a Unity scene, add the following on the line before the m_foo declaration: –

[FormerlySerializedAs(“m_foo”)]

Now rename m_foo to m_bar and go have a look at the scene in Unity. The member name is changed but the assignments aren’t lost.

Once you’ve been in to Unity and the scene has updated, it’s safe to delete the “[FormerlySerializedAs(“m_foo”)]” line as it’s not needed anymore.

Hope it helps!

## Quaternions: Set up an Quaternion to give a specific angle on a specific axis

Again, just dropping this here so I know where to find it. The following will set up a 1 degree rotation around the x axis (in this case it’s just rotating a Unity transform by 1 degree in the x)

```    Quaternion q = a_activeMesh.m_meshFilter.gameObject.transform.rotation;
Quaternion q2 = CreateFromAxisAngle(1.0f, 0.0f, 0.0f, 1.0f * Time.deltaTime);
q = q * q2;
a_activeMesh.m_meshFilter.gameObject.transform.rotation = q;
```
```Quaternion CreateFromAxisAngle(float x, float y, float z, float a)
{
// Here we calculate the sin( theta / 2) once for optimization
float factor = Mathf.Sin(a / 2.0f);

Quaternion q;

q.x = x * factor;
q.y = y * factor;
q.z = z * factor;

// Calcualte the w value by cos( theta / 2 )
q.w = Mathf.Cos(a / 2.0f );

return q.normalized;
}
```