- Home /
Gizmo in Game View
Something that has long puzzled me is how to turn on the 3D gnomon for transforms in the Game View (in the editor). I want to move, rotate, and scale objects looking through the camera. Is this possible? I have the Gizmos toggled ON in the Game View and all the boxes checked in the drop-down menu, but no transform gizmos appear. Am I missing something super basic?
Well, for starters those are handles, not gizmos. No, you can't move objects around in the scene from the camera view without special code- the game view is intended to be as close an analogue to the finished product as possible, so it wouldn't make sense to allow editor-specific actions from it.
That's too bad. Guess it will have to be a feature request. I don't see any reason why handles shouldn't be made available (as an option) in the game view in edit mode.
Answer by Berenger · Mar 07, 2012 at 12:29 AM
I doubt it's natively possible. You'll have to script that yourself. A combination of GUI, GL instructios and 3D object using a shader without depth test, that should do it.
Perhaps you misunderstood my question. I don't need this in the end product, just in the editor in the Game View. I'm talking about using the same built-in gnomon transform tools that's used in the Scene View to transform objects (move, rotate, scale). It shouldn't be necessary to write a custom tool to reinvent a basic tool that's already in the program.
As I've said, it wouldn't be appropriate to allow that functionality in the game view. If it's an editor-only function, it should only appear in the editor itself.
I don't see why it would be inappropriate. Unity allows gizmos to be drawn in the game view, both in edit and play mode, and they aren't rendered in the final built game/app. Why not handles? The point I'm trying to make is that it can be a very useful editing feature to grab and move objects directly in the game view just as you would in the scene view.
Ok, I indeed misunderstood ! Last try, if that's still not helping, I'll delete the answer so you can be in the unanswered list.
So, I still don't know how to draw and use unity transform tools in the gameview, but maybe we can find a way around. I suppose the point is to edit objects from the game camera point of view right ? I found that thread talking about how to move the editor camera. I played a little with it and came up with that code, which copy the selected camera pos and rot to the scene cam. Be very carefull, the functions are undocumented and I did stuff, well, as we say in a very good french, "au feeling". Put it into an Editor folder.
using UnityEngine; using UnityEditor;
public class GetSceneCam : ScriptableObject { [$$anonymous$$enuItem("Camera Copy/Copy Selected Camera To Scene View Camera")] static public void CopyToSceneViewCamera() { Transform selection = Selection.activeTransform; if( selection == null ) return; Camera cam = selection.camera; if( cam == null ) return;
Vector3 position = SceneView.lastActiveSceneView.pivot;
SceneView.lastActiveSceneView.pivot = selection.position;
SceneView.lastActiveSceneView.rotation = selection.rotation;
SceneView.lastActiveSceneView.size = cam.fieldOfView * 0.5F * $$anonymous$$athf.Deg2Rad; // This is totally empirical
SceneView.lastActiveSceneView.Repaint();
}
}
Thanks, that's a pretty clever script! I appreciate your help. Unfortunately it doesn't really work in my case because I'm using an orthographic camera but the scene view is perspective, so things aren't aligning exactly.
Answer by neoRiley · Feb 11, 2015 at 07:51 PM
In the game view, simply click the "gizmos" button in the top right and you'll be able to see gizmos in the game view.
Answer by richard3d · May 09, 2012 at 02:20 PM
I have a script that when combined with a box collider component on an entity will give you the exact functionality of a unity transform gizmo in game mode. You can instantiate this object when needed and delete when not. It also supports rotation (this is the only thing different that the scene gizmo, you rotate around an axis in mine, i found rendering circles to be a waste). Let me know if you want me to post it - R
hey richard3d, I know that the question is old, but I have been looking for an answer everywhere. I want to make a visualization project and I need to have a GUI element in the game, who's functionality mimics the one of the scene gizmo. Click on the cones- the scene rotates(left,right, front,back), click on the cube-changes cameras. Plus the scene gizmo rotates together with the in-game camera. Any ideas?
@$$anonymous$$adrasko Your gizmo would essentially be represented with a game object and a shader forcing it to render in front of other geometry. I doubt that you would want to use immediate mode graphics for this (`GL`). As for interacting with the gizmo, there are several ways, but the easiest would be to just use colliders! Be sure to attach a kinematic rigidbody to the parent game object to avoid poor static collider performance!
Hi Richard3D,
I am very much interested in the runtime Rotation Gizmo, which you can rotate around the centre of object - rotation looks at the mouse position along the circumference. Am also looking at having only once axis of choice visible in game view - hiding xy and just having z rotation gizmo for example. thank you
Hi richard3d! I'm very interested in the runtime Rotation Gizmo.Can you send me the code? jzq740176507@gmail.com or post it? And tell the link?
thank in adcance!
Answer by BabilinApps · Sep 18, 2015 at 08:12 PM
Old thread but we created a product for the problem, you can find it here: http://forum.unity3d.com/threads/in-game-gizmo-transform.299275/
it uses Unity GL renders. It costs $14 but if you really don't have the money tell us your situation and we can work something out. The only reason for the price is that I am a student trying to make money for college.
Your answer
Follow this Question
Related Questions
How to disable the default transform gizmo in editor? 1 Answer
Unity standard water asset not working for LWRP 0 Answers
What's up with my transform gizmo here? 1 Answer
How can I draw a gizmo cone? 1 Answer
Unity 4 Scene Gizmo Old/New 1 Answer