Can I put Transform (gameObject) into GUILayout in javascript?

see I am working on one project that I want to put drag and drop gameObject on GUILayout in javascript If it is possible then how please help me. ,

GUI objects live in GUI coordinates. GameObjects live in world coordinates. So you cannot use real game objects in a GUILayout. With standard GUI calls, you specify the position, so it is possible to get real world objects to track GUI objects, but using GUILayout, you turn over positioning to the class and therefore don’t have the coordinates.

I am not sure exactly what you are aiming for, but @robertbu is correct, you cannot simply place game objects into a GUILayout.

However… if you are using Unity Pro then what you can do is render the meshes associated with a game object or prefab onto a GUI using the Graphics class. You can reserve some space in your GUI layout using GUILayoutUtility.GetRect and then convert from local space of your game object into GUI space. Of course this is probably not for the faint hearted since it will involve some matrix math.

Alternatively, an easier solution, if you are using a GUI solution like NGUI, you could probably just place your foreground game objects onto the “UI” layer. I have not tried this, but I cannot see why this would not work.