Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Multiplatform Runtime Level Editor

Discussion in 'Assets and Asset Store' started by FreebordMAD, Jun 10, 2014.

  1. dotSnipe

    dotSnipe

    Joined:
    Nov 9, 2011
    Posts:
    20
    Actively experimenting with it, but also with a lot of other stuff at the moment.
    Should have some feedback soon.
     
    FreebordMAD likes this.
  2. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,340
    I just played with it on the iphone 4 and on the web player.

    First, it's really an awesome tool. Really great.
    In terms of usability on mobile.

    On the iphone 4. Unity terrain is very sluggish. Cannot really use it. Very slow.
    Editing objects with touch is quite difficult because cannot rotate and pan the camera.
    Once I make a mistake placing the objects and want to change the position, it's very hard.

    There are a few thing that can be added to aid the placement of objects. Definitely some sort of grid system with snapping and presets for camera angles. Like in unity with being able to use a gizmo to change the camera angle. Having a button for perspective and ortho view. Perhaps other presets for the types of game style. Side scroller, Isometric, etc. For example, often times, it's much easier to place objects using an Isometric setup. Most people are used to games that use this kind of system.

    Edit: forgot to talk about the webplayer. Performance of terrain is much better.
    Editing objects need similar things as the mobile version.

    Overall, this is a very promising tool and I am most interested. The asset is still in its infancy and improvements will surely make it totally awesome.
     
    ilmario likes this.
  3. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I'm glad that you like my level editor rocki!


    Unfortunately, this is simply true and I fear that there is not much that I can change here, because my tool is simply based on the Unity Terrain and it was not designed to be modified on runtime. Most performance goes into applying the changes to the terrain, which needs to happen every frame. Calculating the change is less than 15% of the computing time. However, I think that at least for my game (Mad Snowboarding) most users will use their tablets to create levels, while they can use the smaller devices to play the game. Maybe this would also work for what you plan.

    What exactly do you mean by rotating and panning the camera? Do you mean to rotate around an object? This feature is already on the todo list of the next patch.
    Right now you can zoom and you can move the camera left/right and top/down. Also changing the view direction is possible.

    What exactly do you mean here. Are the movement handles hard to use on a device with a small screen or do you mean that the objects do not snap to the terrain?

    Object snapping, snapping to terrain and snapping to a grid are also on the todo list.
    Thanks for the tip with the camera angles and perspectives, this should be easy to implement and could be a good feature also for other developers! I will put it on the todo list too.

    Thanks! The current version of the tool is still its initial version. It took quite a while to get it to the Asset Store. I plan a big patch with many features in the beginning of the next year.
     
  4. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,340
    "What exactly do you mean by rotating and panning the camera? Do you mean to rotate around an object? This feature is already on the todo list of the next patch.
    Right now you can zoom and you can move the camera left/right and top/down. Also changing the view direction is possible."

    Sorry, I meant to say panning to left/right and up/down. The up/down arrow keys seems to be zooming. Whereas the left/right is panning.

    How do you change the view direction? I can't seem to find it.

    "Once I make a mistake placing the objects and want to change the position, it's very hard.
    What exactly do you mean here. Are the movement handles hard to use on a device with a small screen or do you mean that the objects do not snap to the terrain?"

    On mobile the handle is really hard to get at. I forgotten which mobile app, but I've seen some that got a gizmo system that works really well. The snapping on the terrain would also solve situations where I accidental place the object too far below the terrain. In such cases, I'm not able to find it or move it at all.
     
  5. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    On mobile you can swipe with two fingers to change direction. On webplayer you have to hold down the right button to look around.
    On mobile you can swipe with three fingers (spread) to pan the camera and zoom by using the standard zoom gesture with two fingers. Indeed there is no possibility to pan up/down in the webplayer yet.
    Check out the help pages in the level editor.
     
  6. Diawheaties

    Diawheaties

    Joined:
    Sep 17, 2014
    Posts:
    2
    Love this app, it's fantastic.

    Say I have a terrain already set up that I want to modify (in other words, I want to skip the "Create Terrain" GUI). How would you suggest I go about implementing this on an existing terrain?
     
    FreebordMAD likes this.
  7. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Thanks ;)
    If you have a terrain in your level already set up then you can use the code below, but DON'T FORGET that all terrain textures assigned to your predefined terrain must be contained in the terrain texture config!
    Simply add the following code to the LE_GUILevelEditor class after line 189:
    Code (CSharp):
    1. // this should be the line 189 in LE_GUILevelEditor. Add your code below this line
    2. LE_GUI3dTerrain GUI3dTerrain = gameObject.AddComponent<LE_GUI3dTerrain>();
    Code (CSharp):
    1. // access the predefined terrain data of the current active terrain of your level
    2. // and wrap it with a terrain manager, which is then assigned to the GUI3dTerrain instance
    3. GUI3dTerrain.TerrainManager = new LE_TerrainManager(Terrain.activeTerrain.terrainData);
    4. // your terrain must be in the "Terrain" layer, you can set this in the game object,
    5. // but it is included here so that you cannot forget it
    6. Terrain.activeTerrain.gameObject.layer = LayerMask.NameToLayer("Terrain");
    7. // just to be on the safe side call this event
    8. LE_EventInterface.LevelDataChanged(this); // notify listeners that the level data was changed
    I know that right now it feels more like hacking, because you have to make a change to one of my classes, but in the next release there will be a nicer way to solve this task. If you have any questions or something does not work right please do not hesitate to post here again!
     
    Last edited: Nov 14, 2014
    Diawheaties likes this.
  8. Diawheaties

    Diawheaties

    Joined:
    Sep 17, 2014
    Posts:
    2
    Perfect! Works like a charm - thank you very much!
     
    FreebordMAD likes this.
  9. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I'm glad I could help you!
    It would be great if you could do me a favour. When you are finished with your project or have seen enough of my tool to give some feedback it would be great if you could review it in the Asset Store, since it has not even one review yet ;)
     
  10. therealdude

    therealdude

    Joined:
    Mar 8, 2009
    Posts:
    10
    I think this plugin is what I need, but I want to run by a couple of requirements I have for an app to make sure I can do this easily with this plugin. Can you let me know if this is doable?

    I have two roles: admin, enduser.

    I need the admin to be able to place buildings on a flat pre-loaded map (not a terrain), load/save from the web player. Think "urban planning tool". I want a reduced UI for the admin. None of the terrain stuff. Probably just placing and manipulating buildings.

    I need the enduser to be able to load a saved level and do nothing but move around. Actually the level would be loaded by the user automatically. This would be a separate unity project/deployment. Can I reduce the footprint of your plugin to only include level loading? Would I just use a canned FPS plugin for the movement?

    Thanks in advance!
     
  11. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Hello therealdude,

    what you do describe with the admin and enduser workflow is exactly what the editor does. If you load the level from script as it is described below Game: Step 1: Load Level For Playing here then the player will not be able to change or edit the level.

    However, the level editor was designed to include the terrain editor as a main feature. Unfortunately, it cannot be removed easily. However, you could simply hack some of the plugin's code. I would send you sample code if you decide to do so. If you have some time (let's say until mid February) before you want to start your project, then I would include this feature in the next update. You would then simply disable the terrain editor.
    One more thing about saving in the web player, it is not possible to access the hard drive from a Web Player, this is restricted by the Unity Plugin for security reasons. You would need to upload the saved level to a server.


    It is possible to reduce the footprint of the level editor to include the level loading only. You would need to keep only the prefabs of you level objects and some scripts. Yes you can also use a canned FPS plugin for example you could use the FPS system from Unity Standard Assets like it was used in the demo.

    edit: one more thing to be said is that the level file size will be very small if no terrain is included
     
    Last edited: Dec 27, 2014
    ilmario and therealdude like this.
  12. therealdude

    therealdude

    Joined:
    Mar 8, 2009
    Posts:
    10
    Hi FreebordMAD,

    Thanks for the reply.
    \
    I would probably start working on this before mid-feburary, so perhaps I'll ask for the sample code. Would you be able to explain to me how I could use a model or set of models as the base instead of a terrain? or is there just a setting that specifies the Y value where objects are placed/snapped by default?
     
  13. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I have created a little demo showing the level editor without terrain. Check it out here.

    I have added a standard plane and a few standard cubes to the Editor and the Game scene of the project. So this is basically what you call "set of models as the base instead of a terrain". The objects simply need a collider to allow snapping. To specify a specific Y value you could use an invisible collider without renderers.

    Additionally, I have added the following code to the LE_GUIWindowRight.cs class. This code hides the terrain tab button and sets the object tab as default.
    Code (CSharp):
    1.      // hack to remove terrain tab
    2.      // first set the terrain tab button to have an invalid size to hide it
    3.      m_tabBox.SetTabButtonRect(0, new Rect(-50f, -50f, 0f, 0f));
    4.      // then resize the other tab buttons
    5.      Rect tabBtnRect1 = m_tabBox.GetTabButtonRect(1);
    6.      tabBtnRect1.x -= tabBtnRect1.width;
    7.      tabBtnRect1.width += tabBtnRect1.width/3f;
    8.      m_tabBox.SetTabButtonRect(1, tabBtnRect1);
    9.      Rect tabBtnRect2 = m_tabBox.GetTabButtonRect(2);
    10.      tabBtnRect2.x = tabBtnRect1.xMax;
    11.      tabBtnRect2.width += tabBtnRect2.width/3f;
    12.      m_tabBox.SetTabButtonRect(2, tabBtnRect2);
    13.      Rect tabBtnRect3 = m_tabBox.GetTabButtonRect(3);
    14.      tabBtnRect3.x = tabBtnRect2.xMax;
    15.      tabBtnRect3.width += tabBtnRect3.width/3f;
    16.      m_tabBox.SetTabButtonRect(3, tabBtnRect3);
    17.      // now set the object tab to be the default selected tab
    18.      m_tabBox.mSelectedTab = 1;
    19.      OnTabBoxChanged(this, System.EventArgs.Empty);
    This code should go under line 142 in (version 1.01) LE_GUIWindowRight.cs. The LE_GUIWindowRight is a partial class you need to use the right .cs file. The line 142 should look like below.

    Code (CSharp):
    1.      AddElement(m_tabBox);
    There are also other optimizations possible, such as removing all terrain textures, which are linked in the TerrainTextureConfig asset.
     
    therealdude likes this.
  14. paraself

    paraself

    Joined:
    Jun 30, 2012
    Posts:
    139
    Hi Nice plugin, I've always been wanting to have such a tool in my game, to get released from tedious unity staff, and focus on level creation. Excuse me if these questions have been answered before.
    1. Does it support unity2D? I mean, sprite, Rigidbody2D, collider2D...etc
    2. Does it support working on XY plane instead of xz plane?
    3. Does is support saving and loading custom class?Further more, my custom class is heavily utilising c# multithreading, will it conflict with your plugin?
    4. Do you have plans to implement seamless runtime level streaming?

    Thanks for proving such a amazing tool!
     
    Last edited: Jan 6, 2015
  15. serpentxx

    serpentxx

    Joined:
    Jul 26, 2014
    Posts:
    2
    Hey @FreebordMAD,
    Dude this editors got so much potential, I have tried lots of various ones and this alone has the best runtime terrain editing, its lag free, is there any chance you will say the basics of how the terrain editor works.

    Also i think this should really be updated to the modern 4.6 UI, so that people can adjust the UI elements and position with ease for their games.

    Also i found this Open source editor
    https://github.com/mrzapp/opened

    It seems a bit broken, but theres lots of useful features i'll bet you could adapt to this, i.e file browers, Hierarchy and inspector
     
  16. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Hello paraself,
    I'm glad you like the idea behind my level editor! Here are some answers to your questions:
    You can create your own prefabs and put whatever you want into them. Therefore, also Unity 2D features are supported. I have not tried it, but I see no reason why it should not work. I could make a demo for you, if you really think about buying the editor and would like to see a demo with 2D assets.
    Right now you can define objects that can be moved on xyz or not moved at all after being drag and dropped into the level. It is a good feature proposal to allow limitations such as to XY plane only. However, you could write your own script that would bring back your object to a certain Z value, after it was moved.
    If you add your custom class to the prefab of your object then it will also be loaded. The editor does not use any multithreading features, hence I it should work fine.
    This is not planned yet. I cannot promise you anything. It will not be part of the next release.
     
  17. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Hello serpentxx,

    thanks for your feedback! It would be awesome if you could write a review in the Asset Store! My editor has no reviews yet... ;)

    The code of my editor is not hidden or obfuscated. Just look into LE_TerrainManager class. If you have any questions about the implementation feel free to ask!

    This will be not part of the next release, but I think about implementing it for the third patch that will probably be in the beginning of summer 2015.

    Thanks for the hint, I will look into this!
     
  18. paraself

    paraself

    Joined:
    Jun 30, 2012
    Posts:
    139
    Thanks for answering my questions, Sorry that is a lot :D.
    Do you have any plans to integrate object pooling? Because when building a level, we often duplicate a same object for a couple of times, and spread the duplicated ones all around the world, and often we need to set up a camera trigger to activated objects when it's necessary. I personally feel that is a common feature, just curious if it's already implemented or you have already thought about it;D
    Anyway your work is already awesome, it'll be more great that you can make it easier to switch UI;D
     
  19. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    You are welcome! :rolleyes:

    This is not implemented yet.
    If you mean "object pooling" by saying "seamless runtime level streaming" then it is an easy feature that could be included in the next release. Do I get your feature request right:
    Feature 1: Camera trigger mode for level editor objects
    - bool for "camera trigger activation"
    - float activation distance (if "camera trigger activation" is true), objects are deactivated until they get into the given distance to camera​
    - bool for "camera trigger deactivation"
    - float deactivation distance ("camera trigger deactivation" is true), active objects will be deactivated if they are too far away from the camera​
    Feature 2: Camera triggered object spawning
    - bool for "camera trigger spawn"
    - float spawn distance (if "camera trigger spawn" is true), objects are not instatiated until they get into the given distance to camera​
    - bool for "camera trigger despawn"
    - float despawn distance ("camera trigger despawn" is true), instatiated objects will be destroyed if they are too far away from the camera​

    Thanks! This is a huge rework and also a highly breaking change. It would be impossible to upgrade a project using my tool to a new version with exchangeable UI. However, making the UI replaceable and using the new Unity UI is already in the backlog, but not planned for the next patch.
     
  20. paraself

    paraself

    Joined:
    Jun 30, 2012
    Posts:
    139
    I think what you understand is correct. One more thing to point out is that when using object pooling, it's necessary to store the transform properties and all the public fields when objects get despawned. And if objects get spawned, recover the transform properties and all the public fields from where they were stored. Sorry if this what you are already going to do, I just recap it.
    And another question is, is it possible to save level incrementally? I mean, if I only modify a single object in editor mode, it make mores sense that I only save the modified ones instead of saving the whole level again.
    Thanks for your prompt reply, contributing feature request makes me feel a part of your work;D
     
  21. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    This is possible indeed. I will put it on the backlog, but still this would be quite a complex feature, so maybe for the patch in the summer...


    That's how the Unity Asset Store works ;)
     
  22. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Today I start to work on the first patch of my Multiplatform Runtime Level Editor (fulltime for the next weeks)! To the buyers PLEASE TELL ME WHAT YOU LIKE AND WHAT YOU DON'T LIKE! I have received no feedback yet, I'm willing to improve my product, but I need to know what you need.

    [update 25.02.15]
    Patch v1.10 is finished and published!
    Change Log v1.10:
    • FIX: works in Unity 5
    • FIX: UnregisterAll. Now also all event handlers of OnObjectPlaced and OnObjectDragged are unregistered.
    • FIX: crash when deleting all characters of a number input field (e.g. the terrain size)
    • FIX: smoothing with high amount, but small brush (amount was not applied)
    • FEAT: terrain brush projection fits to cell size of terrain data
    • FEAT: read terrain paint height button in paint terrain height tab of the terrain editor.
    • FEAT: added OnTerrainCreated to LE_EventInterface.
    • FEAT: duplicate level objects are removed on save (fix for players hitting clone too often). Feature can be disabled through LE_Config
    • FEAT: improved UI assets
    • FEAT: custom inspector for LE_Object
    • FEAT: limit XYZ movement/scale e.g. only XY (for movement, rotation and scale handles)
    • FEAT: terrain snapping (objects stay on terrain when terrain is raised/lowered, objects stay on terrain when moved)
    • FEAT: object snapping (objects snap to other objects)
    • FEAT: grid snapping (objects snap to a virtual grid)
    • FEAT: E/Q keys (move up and down (just like in the Unity editor))
    • FEAT: flag for moveable objects: is active on start editable by end user
    • FEAT: adapt focus distance to object's renderer bounds
    • FEAT: level streaming (instantiate/destroy depending on camera distance, transformations are cached between destroy and reinstantiate)
    • FEAT: camera perspective gizmo
    • FEAT: camera rotate around pivot (with mouse)
    • FEAT: start with a predefined custom Unity terrain
    • FEAT: configuration flag to hide terrain or object editor
    Below you will find the current backlog, please vote for features if you think my ordering is not right and ask for features if you miss them.
    Backlog (ordered by priority):

    • Update to new Unity UI
    • Undo/Redo
    • Camera rotate around pivot for touchscreen controls
    • UV scaling - scale UV coordinates in materials with the prefab scale
    • Incremental Saving
    • Group/ungroup - grouped objects are moved/scaled with one handle
    • Help: terrain raise/lower
    • Help: terrain smooth
    • Help: terrain paint
    • Help: object placement
    • Help: object transformation
    • Help: object properties/color
     
    Last edited: Feb 25, 2015
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,737
    @FreebordMAD - I just bought a copy of Multiplatform Runtime Level Editor and tried it out. It's very good! I like the ordering of your feature list for v1.1. Please consider these requests, too:
    • 'Q' and 'E' keys to move up and down (just like in the Unity editor).
    • Customizable editor GUI, preferably in Unity UI. Since this is for runtime editing, we'll want to be able to customize the appearance to fit our games.
    • If possible, don't make it a Complete Project import. Since this is for runtime editing, we're probably going to import it into an existing project, and it won't do to overwrite all of our project settings.
    Great work!
     
    BackwoodsGaming likes this.
  24. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Awesome! Great thanks! It would be super cool and even more awesome if you could just copy paste this as a review in the Asset Store, I still have no reviews for my level editor...

    Damn it! I'm working with Unity since Unity 2.6 and didn't know that! I will add this feature to v1.1 it should take no longer than 10 minutes to implement it.

    "Update to new Unity UI" is on the backlog, but it will take me a lot of time... I will do it in the next patch.

    I didn't know the Asset Store does this! I will check this! I never wanted to upload it like that, since I do not use any project related settings in the editor except the terrain layer, which should throw a warning if you have no such layer.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,737
    Done! :)

    I recognize this is a big task, especially if you make the UI layout customizable, but if you're taking votes it's my top feature request. (I can wait until after v1.1 though.)
     
    FreebordMAD likes this.
  26. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I always thought it would be a good idea imagine you made a game and then you wanted to add user created content. So they can upload maps and rate it , i could imagine something like that selling really well
     
  27. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Awesome thanks TonyLi! I will think about including the UI rework in this patch or what is more probable is that I will divide it in two patches, but work on it now. This way people that use older Unity versions below 4.6 will be able to use the old UI with all the new features of the v1.1 patch, also I think it will take me really a lot of time to rework the whole UI (I did not try the new UI system yet, so I will have to learn it myself first).

    @Aiursrage2k: check my game Mad Snowboarding, it works quite well I have already over 400 user created levels in the game
     
  28. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,207
    So it sounds like this could be used for something like Neverwinter's foundry system on steroids for user generated content to actually add the ability to also let the user actually create their terrain? That would rock! lol
     
  29. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    The first patch for the Multiplatform Runtime Level Editor is out now in the Unity Asset Store!
    The most important news is that the level editor now works with Unity 5 also there are two new features that were requested by the people here object snapping (to terrain, to a grid, object to object) and level streaming (only objects close to the camera are instantiated -> faster level loading + less memory consumption). See the full change log below:
    Patch v1.01 to v1.10:
    FIX: works in Unity 5
    FIX: UnregisterAll. Now also all event handlers of OnObjectPlaced and OnObjectDragged are unregistered.
    FIX: crash when deleting all characters of a number input field (e.g. the terrain size)
    FIX: smoothing with high amount, but small brush (amount was not applied)
    FEAT: level streaming (instantiate/destroy depending on camera distance, transformations are cached between destroy and reinstantiate)
    FEAT: terrain snapping (objects stay on terrain when terrain is raised/lowered, objects stay on terrain when moved)
    FEAT: object snapping (objects snap to other objects)
    FEAT: grid snapping (objects snap to a virtual grid)
    FEAT: limit XYZ movement/scale e.g. only XY (for movement, rotation and scale handles)
    FEAT: custom inspector for LE_Object
    FEAT: improved UI assets
    FEAT: terrain brush projection fits to cell size of terrain data
    FEAT: read terrain paint height button in paint terrain height tab of the terrain editor.
    FEAT: added OnTerrainCreated to LE_EventInterface.
    FEAT: duplicate level objects are removed on save (fix for players hitting clone too often). Feature can be disabled through LE_Config
    FEAT: E/Q keys (move up and down (just like in the Unity editor))
    FEAT: flag for moveable objects: is active on start editable by end user
    FEAT: adapt focus distance to object's renderer bounds
    FEAT: camera perspective gizmo
    FEAT: camera rotate around pivot (with mouse)
    FEAT: start with a predefined custom Unity terrain
    FEAT: configuration flag to hide terrain or object editor



    p.s.: the next patch is planned to be in April 2015 (latest in May 2015) it will have the Unity 5 UI and more awesome stuff
    p.p.s.: still missing ONLY ONE RATING, please guys (maybe even girls) give me one more review! Then the review stars will be shown in the search overview for my level editor. Don't give me 5 stars if you don't want to just give me a honest review ;)
     
    Last edited: Feb 25, 2015
    TonyLi likes this.
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,737
    Nice update! I'm looking forward to the new UI and more options to customize the UI.
     
    FreebordMAD likes this.
  31. SuHwanK

    SuHwanK

    Joined:
    Dec 30, 2014
    Posts:
    43
    Hi, I bought MRLE asset.
    how i used object editting(on AxisObject) script?
    i just need to only some function about editting object.
    so i did it. look like function.(GetEditDelta function.)
    but didn't working like MRLE.
    for example, i selected changePosition Mode. and Input mousePos.
    X axis right, left -> object Move left, right..
    I understood that the code is reflected in the calculation by the camera position in this section.
    so what's wrong with me? I need Calculated by including everything(cameraPos, mousePos, objectPos). thank you.
     
  32. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Thanks for buying my asset!

    Do I understand it right that you want to use the edit handles (LE_ObjectEditHandle script)?

    Which functionality of those do you want to have?

    Sorry, I don't understand what exactly you want to achieve. Maybe you can post your code? You can send me your code via PM if you don't want to share it in public.
     
  33. SuHwanK

    SuHwanK

    Joined:
    Dec 30, 2014
    Posts:
    43
    Hi, How are you today?

    I think you got the point. I am trying to ObejctEditHandle. I would like to use UI regarding to transfer, rotate, size and related functions.

    So far, I applied controller regarding transfer,rotate,size from your plug-in. and It worked fine. However, I have a problem with applying camera rotation and position. I did it as same as yours but it has a problem with input value( it was reversed).

    I think this is because of either wrong Parameter that I put or something wrong with solution. It might hard to understand my formula. I would like to know what is wrong with it.

    So I attached code in order to help you understand easier.

    (revised function)------------------------------------------------------------

    private float GetEditDelta(Vector3 axis)
    {
    Vector3 editAxisInScreenCoords = Camera.main.WorldToScreenPoint(uC.selected_Go.transform.position + uC.selected_Go.transform.TransformDirection(axis)) - Camera.main.WorldToScreenPoint(uC.selected_Go.transform.position);

    float zFactor = 1f / Mathf.Acos(Mathf.Clamp(editAxisInScreenCoords.z, 0f, 0.95f));

    editAxisInScreenCoords.z = 0;

    editAxisInScreenCoords.Normalize();

    float distToCam = (Camera.main.transform.position - uC.selected_Go.transform.position).magnitude;

    return GetEditDelta(editAxisInScreenCoords, zFactor*distToCam);
    }

    private float GetEditDelta(Vector3 p_screenAxis, float p_multiplier)
    {
    float mouseDeltaInAxisDir = Vector3.Dot(p_screenAxis, Input.mousePosition - m_lastMousePos);

    Vector3 rayDirAfter = Camera.main.ScreenPointToRay(m_lastMousePos+mouseDeltaInAxisDir*p_screenAxis).direction;

    Vector3 rayDirBefore = Camera.main.ScreenPointToRay(m_lastMousePos).direction;

    return (rayDirAfter-rayDirBefore).magnitude*Mathf.Sign(mouseDeltaInAxisDir)*p_multiplier;
    }
    -----------------------------------------------------------------------------------------------------------------------
    Meaning of aboved ariable funtion.

    uC.selected_GO : selected GameObject.
    axis : new Vector3(mousePos.x, mousePos.y, (uC.selected_Go.transform.position.z - Camera.main.transform.position.z))
    m_lastMousePos : Input.mousePos stored base on MRLE frrm LateUpdate
    -----------------------------------------------------------------------------------------------------------------------

    In our project, transfer, rotate and size are handled by frame unit based on bool value. in other words, Update(frame) units are call out from GetEditDelta.

    I will look forward to hear from you. and I am sorry for hazing you.

    have a great day. Thank you.
     
  34. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Hello SuHwanK,

    now I understand what you are trying to do. However, the "LE_ObjectEditHandle" script is not the script that you want to change. It is better to change the "LE_ObjectEditHandleCollider" script.

    Please try to change the code in the OnMyMouseDown and OnMyMouseDrag functions of the "LE_ObjectEditHandleCollider" script:
    Code (CSharp):
    1. private void OnMyMouseDown()
    2.     {
    3.         // CHANGED BEGIN
    4.         if (m_axis == Vector3.right)
    5.         {
    6.             m_parent.OnMyMouseDrag(m_parent.transform.InverseTransformDirection(Camera.main.transform.right));
    7.         }
    8.         else if (m_axis == Vector3.up)
    9.         {
    10.             m_parent.OnMyMouseDrag(m_parent.transform.InverseTransformDirection(Camera.main.transform.up));
    11.         }
    12.         else
    13.         {
    14.             Debug.LogError("Illegal axis!");
    15.             return;
    16.         }
    17.         // CHANGED END
    18.         renderer.material.color = Color.yellow;
    19.         m_isDrag = true;
    20.     }
    21.  
    22.     private void OnMyMouseDrag()
    23.     {
    24.         // CHANGED BEGIN
    25.         if (m_axis == Vector3.right)
    26.         {
    27.             m_parent.OnMyMouseDrag(m_parent.transform.InverseTransformDirection(Camera.main.transform.right));
    28.         }
    29.         else if (m_axis == Vector3.up)
    30.         {
    31.             m_parent.OnMyMouseDrag(m_parent.transform.InverseTransformDirection(Camera.main.transform.up));
    32.         }
    33.         else
    34.         {
    35.             Debug.LogError("Illegal axis!");
    36.             return;
    37.         }
    38.         // CHANGED END
    39.         m_isDrag = true;
    40.     }
    41.  
    It is likely that you will want to make the handles look in the right direction (camera oriented) to do so, please add the code below to the "LateUpdate" function:
    Code (CSharp):
    1. private void LateUpdate()
    2.     {
    3.         // CHANGED BEGIN
    4.         if (m_axis == Vector3.right)
    5.         {
    6.             transform.right = Camera.main.transform.right;
    7.         }
    8.         else if (m_axis == Vector3.up)
    9.         {
    10.             transform.up = Camera.main.transform.up;
    11.         }
    12.         // CHANGED END
    13.  
    14.         ... keep the rest of the code
    To make it all easy for you I have uploaded a Unity package for you. You have received the link via PM, please tell me when you have downloaded the code sample, so that I can remove it from the server.

    you code is hard to read please use the "[ c o d e = C S h a r p ] [ / c o d e ]" tags the next time
     
    Last edited: Mar 1, 2015
  35. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    103
    Hey, really cool asset. Just tried it in my nexus5 and it runs buttersmooth!
    There are 4 things which i dont like:
    - old GUI. But you said you will update it in April :)
    - rorating the camera around a object is kinda weird and i really didnt geht it how it works. 2 fingers? 3 fingers? :D
    - 3 fingers to move the camera. It would be better like in clash of clans. Using one Finger to move the camera but only when you are not over a building.
    - do you have a mass building Funktion in plan like in here:
    at 4:10?

    With all that stuff in place, i would buy it :)
     
  36. SuHwanK

    SuHwanK

    Joined:
    Dec 30, 2014
    Posts:
    43
    Thank you for your help.
    I received your package.
    But I can not apply to it.
    It is not workable with "LE_Object" format.
    I only need a formula to transform Object.
    Do I have anything worng with code?

    Code (Csharp):
    1.  
    2. mF = GetEditDelta(new Vector3(mousePos.x, mousePos.y, (uC.selected_Go.transform.position.z - Camera.main.transform.position.z)));
    3. if(Axis == Xaxis)
    4.    directionAxis = selected_Go.transform.InverseTransformDirection(Camera.main.transform.right);
    5. else if(Axis == Yaxis)
    6.    directionAxis = selected_Go.transform.InverseTransformDirection(Camera.main.transform.up);
    7. else
    8.    directionAxis = selected.Go.transform.InverseTransformDirection(Camera.main.transform.forward);
    9. selected_Go.transform.position += directionAxis * mF;
    10.  
    Thank you.
     
    Last edited: Mar 2, 2015
  37. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Thanks! ;)

    Yep, this is the most important feature on the list right now.

    Rotating around an object does not work right now on touch. I have to make up some new gesture, but I don't know yet what I will do... But it did work for you to look around with two fingers right?

    Thanks for the tip! I will get Clash of Clans and take a look! I need some other gesture handling anyway, since I don't want to make something like 4 fingers to look around an object ;)

    I didn't exactly understand which function you mean? Could you please tell me the exact time in the video or write down which functionality you would like to have?
     
  38. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    You still could try to extract the code that you need from my example I think. Does my example do what you need?

    This will not work, because
    Code (Csharp):
    1.  
    2. new Vector3(mousePos.x, mousePos.y, (uC.selected_Go.transform.position.z - Camera.main.transform.position.z))
    3.  
    is not an axis it is rather a position in screen coordinates, but whatever you pass to GetEditDelta must be in local coordinates of the object which is moved. I cannot test what I'm writing now, because I have not the rest of your script, but you could try to apply it to your work.
    Code (Csharp):
    1.  
    2. if(Axis == Xaxis)
    3. {
    4.    Vector3 camRightLocal = selected_Go.transform.InverseTransformDirection(Camera.main.transform.right);
    5.    directionAxis = camRightLocal;
    6. }
    7. else if(Axis == Yaxis)
    8. {
    9.    Vector3 camUpLocal = selected_Go.transform.InverseTransformDirection(Camera.main.transform.up);
    10.    directionAxis = camUpLocal;
    11. }
    12. else
    13. {
    14.    Debug.LogError("ERROR: there cannot be another axis except X and Y for camera transformations, since you cannot calculate its delta...");
    15.    return;
    16. }
    17. selected_Go.transform.position += directionAxis * GetEditDelta(directionAxis);
    18.  
     
  39. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    103
    jap. look around with two fingers worked fine. at least up and down :) and zooming is also smooth

    yeah, even more than two fingers is pretty unusual. i think the most common way is to move around with one finger, zoom and rotate with two fingers. if you have a ios device you should also check out "raids of glory". i think they did it perfectly with moving around in a 3d canvas.

    its at 4:10 - where you can drag a floor building over the whole canvas instead of building each one seperatly. pretty good for building walls
     
  40. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    Thanks again for the tip! I have put the rework of the touch interface on the backlog and will take a look at both games!

    Ok, I see. This would be indeed possible, but actually only for the grid snapped objects. I will put this on the backlog, but I don't think that this will make it into the next patch, because the grid based objects are only a very small piece of the editor right now. I think there are more important features that need to be done first. My level editor is rather meant to be a free 3d editor than a grid snapping tool.


    @SuHwanK: did you already had the time to try my code above?
    http://forum.unity3d.com/threads/mu...any-one-interested.250920/page-2#post-1990339
     
  41. SuHwanK

    SuHwanK

    Joined:
    Dec 30, 2014
    Posts:
    43
    Hi, again
    I referred your code and made slight change. Now, it works fine. mouse movements on X,Y,Z corrdinates also works well.

    However, when i change rotate on the object and try Move to object, it is giving me wrong axis.
    Is it because of local and world?

    And, Axis on the code you sent me. does that represents X and Y coordinates of mouse?(from Screen)

    Here is my code.
    Code (cshape):
    1.  
    2. void Update()
    3. {
    4.   if(mousedrag Axis X Object)
    5.   {
    6.     directionAxis = selectedObject.transform.InverseTransformDirection(Vector3.right);
    7.     if(editMode == move) selectedObject.transform.position += directionAxis * GetEditDelta(directionAxis);
    8.     else if(editMode == rotate) selectedObject.transform.eulerAngles += directionAxis * GetEditDeltaRotation();
    9.     else if(editMode == scale) selectedObject.transform.localScale += directionAxis * GetEditDelta(directionAxis);
    10.   }
    11.   else if(mousedrag Axis Y Object)
    12.   {
    13.     directionAxis = uC.selected_Go.transform.InverseTransformDirection(Vector3.up);
    14.     ...
    15.   }
    16.   else if(mousedrag Axis Z Object)
    17.   {
    18.     directionAxis = uC.selected_Go.transform.InverseTransformDirection(Vector3.forward);
    19.     ...
    20.   }
    21.   ...
    22. }
    23.  
    Thank you.

    ps. after rotate mode. then execute move object command. and set move on mouse.
    mouse axis(Input) is inverted relative to previous position value(before move object command).
     
    Last edited: Mar 3, 2015
  42. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    The code that I have sent you represents the X and Y axis in screen coordinates of the camera. SuHwanK I still don't know what you are trying to achieve. Please try to explain it in detail, can you also make some screenshots? I cannot help you if I don't know what you are doing.

    Using this code your object should always move on the X, Y, Z axis of the world independently of its rotation.

    I don't understand what is happening, please make some screenshots or a short video.
     
  43. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    For those who will want to use the GetEditDelta code outside my classes. Here is the solution for it that we have figuered out with SuHwanK:
    Code (csharp):
    1.  
    2. void Update()
    3. {
    4.   if(mousedrag Axis X Object)
    5.   {
    6.      Vector3 directionAxisLocal = Vector3.right;
    7.      Vector3 directionAxisGlobal = selectedObject.transform.right;
    8.      if(editMode == move) selectedObject.transform.position += directionAxisGlobal * GetEditDelta(directionAxisLocal);
    9.      else if(editMode == rotate) selectedObject.transform.eulerAngles += directionAxisLocal * GetEditDeltaRotation();
    10.      else if(editMode == scale) selectedObject.transform.localScale += directionAxisLocal * GetEditDelta(directionAxisLocal);
    11.   }
    12.   else if(mousedrag Axis Y Object)
    13.   {
    14.     directionAxis = Vector3.up;
    15.     ...
    16.   }
    17.   else if(mousedrag Axis Z Object)
    18.   {
    19.     directionAxis = Vector3.forward;
    20.     ...
    21.   }
    22.   ...
    23. }
    24.  
     
  44. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I'm working on porting my level editor to the new Unity UI for quite a while now, but I think today it is time to ask for some feedback! So far the terrain tab is fully functional and the level can be saved, loaded and played.
    • What do you think about the slightly rotated 3d UI?
    • What do you think about the animations?
    • What do you think about the interface (see below)?
    Try it here: Multiplatform Runtime Level Editor v1.20 alpha preview


    I have fully separated the editor code from the UI code. Additionally, it is now easily possible to use only small parts of the UI. You can go to the example scene and simply delete the texture paint tab or the objects tab and the level editor will still work correctly. Besides, you can add your elements to the UI or move or change it as you want. To explain the interface here is some sample code:
    Code (CSharp):
    1.  
    2. // if you want to provide a base texture selection, then simply register to an event handler like this:
    3. LE_GUIInterface.Instance.delegates.SetTerrainBaseTextures += (Texture2D[] p_textures, int p_selectedIndex)=>
    4. {
    5.   ... your code here. // Create a list of textures and show it to the user so that he can select the one he wants. You can use uGUI, nGUI, OnGUI or what ever GUI library you like, because the level editor will not care ;)
    6. };
    7.  
    8. // once the user has selected a texture in your base texture selection, inform the level editor like this:
    9. LE_GUIInterface.Instance.OnTerrainBaseTextureChanged(newSelectedIndex);
    10.  
    The code above is simple and easy to understand. It gives you the freedom to implement your features as you want. If you don't need a base texture selection or any other feature, then you simply do not implement the event callbacks.

    You guys below might be interested in the new Unity 4.6/Unity 5 UI
    @imtrobin
    @.Snipe
    @TonyLi
     
    Last edited: Mar 13, 2015
  45. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I finally finished the UI port to the new uGUI. Now I need to rewrite the docs and I want to make a second little demo showing how easy it is now to use the level editor for example in a dungeon game. Check the Web Player Alpha Here!

    EDIT: just uploaded the final v1.20 version. Now I'm writing the docs and making the last tests. I plan to submit the Multiplatform Runtime Level Editor v1.20 to the Asset Store in the beginning of the next week.
     
    Last edited: Mar 19, 2015
    twobob likes this.
  46. commodore

    commodore

    Joined:
    May 30, 2012
    Posts:
    36
    Any word on the new update? I'm excited

    Also, I like the hierarchy for the objects.
     
  47. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    I'm glad to hear that there are people waiting for the update! Unfortunately, while the functionality for the next patch is already finished, the project is still in the test phase. I hope that I will be able to upload the version in the middle of the next week. However, it will take up to two weeks until the patch is approved in the Unity Asset Store once it is submitted.

    To explain the delay in a little more detail: I have encountered a Unity Engine bug related to Terrain.SetNeighbors in the 9 patch terrain demo. This bug leads to a crash in the Editor, but also in the runtime version. It took me quite a while to search for a workaround (without success :( ) and to reduce the project and submit a bug report. Now I still need to make changes to the project to be sure that it will not crash...
     
  48. mfleurent

    mfleurent

    Joined:
    Mar 5, 2015
    Posts:
    25
    hi,

    Very nice asset, can't wait for this update :p

    We are in the process of integrating MRLE in our app and we need the uGUI port to adapt the gui in app
    Also, we don't use the terrain functionality :D
     
    FreebordMAD likes this.
  49. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    534
    @mfleurent, @commodore: I have uploaded the first release candidate as a draft to the Asset Store. It still needs much testing. Yet I have tested only Windows (.exe), Android and Web. Also, a full functionality test has not yet been done. However, if you guys already own the MRLE and want to get the release candidate now, then please send me a PM or an email. I expect no big changes in the API or scenes, but still if bugs will arise there might be the need for change.

    EDIT: the Multiplatform Runtime Level Editor v1.20 is now submitted for approval to the Unity Asset Store. I'm sure that there is no reason for it to be rejected, therefore, it will be officially released somewhere between the 7th and 15th April.
     
    Last edited: Apr 1, 2015
  50. mfleurent

    mfleurent

    Joined:
    Mar 5, 2015
    Posts:
    25
    cool,

    My partner (alexander bolton), who buy MRLE with his account will contact you

    Thanks for your reactivity, really appreciated
     
    FreebordMAD likes this.
unityunity