Runtime Handles is a set of scripts, which will help you to implement runtime scene/level editor. Package divided into several parts, could be used together or independently.
Features: Positon handle, Rotation handle; Scale handle; Grid; Box Selection; Selection gizmo; Unit & Bounding Box Snapping; Snap To Grid; Focus & Auto-Focus; Global & Local coordinates; Runtime Undo & Redo; Runtime Save & Load (PlayerPrefs) Editor Demo
It will be possible with version 1.11
Battlehub/RTHandles/Scripts/RuntimeHandles.cs
public static class RuntimeHandles
{ public const float HandleScale = 1.0f; Send your order number to Vadim.Andriyanov@outlook.com and I’ll send you latest version with this option
I would like to buy your program Runtime Editor.
For this I have some questions:
1.How can I zoom out and zoom in?
2.How can I save as name and load as name? Where is everything stored?
3.Can I edit and change the buttons, etc. in the editor?
4.I can install my own objects
I think the rotation behavior with several objects selected is a bit weird:
Rather, they should rotate around a common origin (preferably center of all selected objects).
I’m not a big fan of the ResourceMap. Having code that tracks the whole project and slows it down isn’t acceptable, especially if you’re not even interested in the undo-redo functionality. There should be an officially supported way to disable this.
The ExposeToEditor workflow is really neat, but I’d like to see options for what tools are supported as well (maybe the user wants some objects to only be rotatable or movable for example).
problem with rotation fixed (rotation mode could be either: local or pivot)
ResourceMap is not slowing down project anymore, and could be removed at all. User could implement IProjectManager or ISceneManager interface and use own save & load functionality.
Undo Redo could be disabled: Battlehub.RTCommon.RuntimeUndo.Enabled = false;
Thank you for reporting about this problem. I think that you don’t have to switch off antialiasing in quality settings. MSAA should be disabled only on camera which is used to render SceneGizmo. All other cameras could have allowMSAA set to true. I’ve tested it with WebGL build in latest Chrome and Firefox on windows 10 platform.
Could you confirm that you have m_camera.allowMSAA = false in Battlehub/RTHandles/Scripts/SceneGizmo.cs, so we could narrow the problem?
Here is code to clamp angles per object. Attach ClampAngles script to required objects and set Angle to desired value
using Battlehub.RTCommon;
using Battlehub.RTHandles;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class ClampAngles : MonoBehaviour
{
public float Angle = 45;
private const float DefaultAngle = 15;
private static RuntimeSelectionComponent m_selectionComponent;
static ClampAngles()
{
RuntimeSelection.SelectionChanged += OnRuntimeSelectionChanged;
RuntimeTools.ToolChanged += OnToolChanged;
}
private static void OnToolChanged()
{
TryUpdateRotationHandle();
}
private static void OnRuntimeSelectionChanged(Object[] unselectedObjects)
{
TryUpdateRotationHandle();
}
private static void TryUpdateRotationHandle()
{
if (RuntimeTools.Current != RuntimeTool.Rotate)
{
return;
}
if (m_selectionComponent == null)
{
m_selectionComponent = FindObjectOfType<RuntimeSelectionComponent>();
if(m_selectionComponent == null)
{
Debug.LogError("Unable to find RuntimeSelectionComponent");
return;
}
}
RotationHandle rotationHandle = m_selectionComponent.HandlesParent.GetComponentInChildren<RotationHandle>(true);
IEnumerable<ClampAngles> clampAngles = RuntimeSelection.gameObjects.Where(go => go.GetComponent<ClampAngles>() != null).Select(go => go.GetComponent<ClampAngles>());
if (clampAngles.Any())
{
rotationHandle.GridSize = clampAngles.Max(ca => ca.Angle);
}
else
{
rotationHandle.GridSize = DefaultAngle;
}
}
}
To fix problems with Postion, Rotation, Scale, Grid, SceneView and other components, set SceneCamera field to your camera. Your camera should have GLCamera script attached.
Hi! Great work with this package, it’s awesome
I have a question, how do listbox and treeview work?? i can use them for create a hierarchy with only instantiated elements in the scene (like cubemen and blocks)?
Hi, how can i activate the selection of an object, and his handles, from a button and not only from raycast?? What function of what script should i call?
Hi,
to select object programmatically please use RuntimeSelection class
using UnityEngine;
using Battlehub.RTCommon;
public class Test : MonoBehaviour {
public GameObject Obj;
// Use this for initialization
void Start () {
RuntimeSelection.activeObject = Obj;
}
}
Great Asset. However, looking through the code i can’t figure out how to clamp position and scale of objects. Given i’m I’m not an amazing programmer, however is there a way for me to do it without interfering with Runtime Handles? I’ve a simple clamp script that updates every frame, but if the object is being dragged, it does not clamp until you let go of the handle. And even afterwards, it doesn’t clamp properly. Is this a built in function? I can’t seem to find it.