[imglink img=”369″ link=”TransformPro on the Asset Store” href=”https://www.assetstore.unity3d.com/en/#!/content/82852″]A much more advanced version of TransformPro is now available on the asset store![/imglink]
Creating scenes in Unity can be a bit of a chore.The layout tools are functional, but somewhat lacking in features.
Nowhere is this more obvious than the Transform inspector. For the single most important and commonly edited component in the engine, the inspector certainly is bare bones.
In general use this is fine, but when doing a lot of intensive scene layout there are a number of situations that start to get annoying. Often I’ve found I’ve accidentally forgotten to reset the position of an empty game object before adding children to it, or moved a child object instead of the parent.
All of these things can be fixed of course, but I’ve found myself copying and pasting individual axis data, or changing the parent and spamming zeros into the transform editor more times than I care to remember.
To try and improve on this, I’ve written an editor extension, TransformPro.
This replaces the default Transform editor. I was initially skeptical about this approach, but I’ve been using it for some time now without any issues. The default editor is still used when you multi-select objects for now. It also does not affect the RectTransform editor.
Local and World Space
Switch between working in Local space and World space. This can be extremely useful when laying out a scene, as you can move one object to the position of another, without changing parenting or using axis by axis copy and paste.
Quickly clear all the data in the transform to default values (Position = [0,0,0], Rotation Euler = [0,0,0], Scale = [1,1,1]). This applies to the current space mode you have selected, so in local mode this resets the object to the parent position and orientation, and in world space mode this returns the object to the origin.
Copy & Paste
Copy the values into a buffer and paste them back later. Extremely useful when laying out scenes, especially in world space mode. You can copy the entire transform, or the position, rotation or scale separately. These can then be pasted back independently, i.e. you can copy the position from one object and the rotation from another, and then paste the combined transform to another.
Quick rotations now provide simple tools to reset an axis or increase / decrease it by 30, 45 or 90. This combined with the new grid system is much simpler and more flexible.
Version 1.1 now includes grid snapping for both the position and rotation. You can update the grid size inside the advanced panels for each. If you want to exclude a specific axis from being snapped just use 0 for the grid setting. The main snap button at the top left will snap both position and rotation.
You can now access a number of API features at runtime:
TransformPro.GridPosition = new Vector3(2,2,2); // Change the position grid
TransformPro.GridRotation = new Vector3(45,45,45); // Change the rotation grid
TransformPro.Snap(transform); // Snaps both position and rotation, using the current grid
Vector3 snapped = TransformPro.SnapPosition(position); // Gets the snapped position, using the current grid
Vector3 snapped = TransformPro.SnapRotationEuler(rotationEuler); // Gets the snapped rotation, using the current grid
Quaternion snapped = TransformPro.SnapRotation(rotation); // Gets the snapped rotation, using the current grid
All the actions you take within the editor now register with the unity Undo system, meaning you can, well, Undo them.
- A sensible product page for this, instead of a blog post…
- Full grid support: I’m hoping to extend this to give full automatic snapping of positions and rotations to a grid in the next version.
- Better Scale: Currently there’s no way to copy and paste world space scales. This is a problem even for unity, hence the use of “localScale” and “lossyScale”. However I intend to provide tools to approximate the world scale – it’s better than nothing!
- Bounds support: Even better would be the ability to work with bounds instead of scales. This way you can make an object the same size as another without ever getting involved with the scale. There may also be some value in allowing you to resize Renderers to match Colliders, and vice-versa.
- Save data to preferences: Currently the grid sizes reset on build. By storing them in the preferences these will remain as you set them permanently.
That covers everything for now. It’s a relatively basic extension in it’s current form, but I find when it does come in handy, it comes in really handy.
Just drop the TransformPro folder anywhere inside your Assets to install.TransformPro-v1.0.zip (291 downloads)
If you find any bugs, have any suggestions or requests, just let me know in the comments.