Search Unity

Multiplatform Runtime Level Editor

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

  1. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    Also @FreebordMAD , I noticed (In LE_SaveLoad) that there is code that deals with "duplicate" objects, by both detecting and systematically deleting duplicates. How can duplicates be created in general: Where do they come from, what causes them to occur?

    Thanks!

    upload_2019-7-28_15-52-21.png
     
  2. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    I have an odd problem that I do not know how to fix in-game, but the MRLE seems to fix this in editing mode.

    When I load a multi-terrain-sector level in regular gameplay mode in my game, there are these odd seams / curves that appear on the borders of terrains. (Note, the blue line is the highlighted outline of the body of water, and does not matter)


    upload_2019-8-4_18-41-16.png

    ...However, when I load the exact same terrain sectors in the MRLE, the seam/rounding of edges does not exist! The image below is taken from the terrain loaded int he MRLE scene:

    upload_2019-8-4_18-39-44.png

    I am very confused as to why this is happening: It occurs all over the test level map I am using: It's like the border edges of individual terrains are being rounded or curved automatically by some method somewhere. The weird thing is, I am not doing anything with my in-game mode code that would have this effect: Is Unity itself auto-rounding the edges of terrain borders for some reason? As a note, both pictures are taken at runtime, as nearly all my in-game terrain is loaded and created at runtime!

    The issue does not occur when I load in the MRLE: Did you encounter this problem too, and force suppress it somehow?

    Thank you!
     

    Attached Files:

  3. reflipd

    reflipd

    Joined:
    Jun 4, 2019
    Posts:
    5
    Hi these are some pre-purchase questions I have. Is there a way I can monetize this when my players go to access it? Maybe, charge them for server blocks? Also can the assets be blacklisted, so I prevent certain assets from being used to create new levels? Then finally I would like it save only to a server, and can it be altered to work on consoles with the buttons on the controllers mapped to mouse and keyboard functions?
     
  4. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Sorry for the late reply. I hope you have found it already if not - here is what you need to do:
    1. find the DebugScript class
    2. Check the HandleLog method
    3. Either remove the whole script from scene or add some exceptions, for example this line ignores the corresponding warning:
    Code (CSharp):
    1. if (logString.StartsWith("LE_LevelEditorMain: Inspector property")) { return; }
     
  5. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    By clicking the duplicate button to often in the editor ;)
     
  6. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Could it be that you have the 9 patch script attached in the editor, but not in the game scene?
     
  7. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Hi there, thanks for your interest in the MRLE.

    This is not part of the MRLE, but you could code it yourself. Check this article to see how you can limit objects being place able or not. You could add your logic here to check whether the item is purchased or not.
    http://www.freebord-game.com/index....cumentation/level-object-placement-limitation

    Again the same prevent the items from being used by checking while the user drags them.
    http://www.freebord-game.com/index....cumentation/level-object-placement-limitation

    You need to write your own saving code, but as you can see it is not impossible as my game Mad Snowboarding saves the levels on a PHP/MySQL server.
    Regarding controller input my answer to the question asked by @Zed2100 might be interesting - you also could try to contact Zed2100.
     
  8. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    Thanks for the replies @FreebordMAD !

    It is definitely not the 9Patch script: I have been using it in the MRLE, but I disabled it to test this issue, and the sectors still match up seamlessly in the MRLE, but get jagged edges and weird shadows when I load them in my normal game scene.

    These sectors were made ahead of time, and are being re-loaded from identical data into the MRLE or my game scene, yet there is this odd difference. I was talking with Amand (Creator of the DiggerPro terrain tool Asset), and he said that they noticed the same weird auto-altering of terrain borders and shadows in their tool (Which is completely separated and unrelated to the MRLE). Amand said that he determined that his own tool was not causing it, yet he was not sure why Unity was automatically causing this to happen for some reason (So it seems to be something underlying about how Unity handles terrains next to each other). The official Unity Discord admin Wyatt mentioned it is a known issue, and that they are looking into fixing it.

    However, for it being a Unity-terrain issue, you seem to resolve it in the MRLE, even when the 9Patch script is not active! Do you have any ideas why the issue does not happen in the MRLE, and how I could potentially mute the issue in my own scenes?
     
  9. reflipd

    reflipd

    Joined:
    Jun 4, 2019
    Posts:
    5
    Awesome thanks for the response. I am looking into this now.
     
    FreebordMAD likes this.
  10. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    Great news, I actually was able to isolate the issue I was encountering with the terrain seams, and eliminate the issue!

    upload_2019-8-21_12-56-28.png

    Our game's implementation was loading nearly all of the world's terrain from our data at runtime, except for exactly one "supersized sector", which was being loaded programatically via a prefab. For some reason, this one case with this single terrain piece somehow messed with all of the terrain loading for the entire scene, likely due to an underlying bug in Unity itself.

    All I did was remove the special-case terrain piece, and now all of the rest of our terrain loads seamlessly as it should! Sorry for the confusion, haha
     
    FreebordMAD likes this.
  11. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    Hello @FreebordMAD !

    I've been doing some work with objects and snap data now. I noticed that I am encountering a weird error with the snapToTerrain on some of the trees that came built-in. I am not sure if my changes or causing this, or if this is something that you have encountered before (As a note, I think I encountered this a few times before I transitioned code from 1 sector to 9 multi sectors, so I do not think my new changes are causing this):

    Sometimes, trees that are placed on elevated surfaces spawn at y=0 instead of their intended position. Yet other times when I load, they spawn in the correct y position. Do you know what causes snapToTerrain objects to default to y=0, and what may be causing this?

    upload_2019-8-23_17-15-39.png

    Thanks!
     
  12. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    Also, how does terrain-snapping work in general? I looked into snapping, and I think I saw some key-value pairs being saved to the stream, what makes the key and the value for trees that snap to the terrain? Thanks!
     
  13. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    A few things that come to my mind:
    * Are there any other scripts on your trees?
    * Are all terrains in the same layer, which is valid for raycasting - is this layer configured to be the terrain layer?
    * Do all terrains also have a terrain collider?

    Generally terrains snapping is done, while in editor mode. The LE_Object.SnapType property defines the behavior.
    In the LE_LogicObjects.AddTerrainSnapping you will see the S_SnapToWorld script being attached to all objects with terrain snapping enabled.
    The script is configured to snap at everything within the terrain layer rotating to match terrain normals.
    Nothing special is saved to the meta data (the key-value pairs are for object snapping - not terrain).
     
    MJDevsGames likes this.
  14. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    Thanks for the information!

    I've figured out the cause of the problem, but I am having trouble locating the place where I need to put the solution. So, with my implementation, I have 9 pieces of terrain in a 3X3 square. What is happening is that when I place a terrain snapping object (Like a tree), it visibly snaps correctly to the correct location in the editor.

    However, the issue is that some times during the Saving snap data process, (Such as when a tree is too close to a large wall of terrain), the object somehow "resets" its snap data I think. The issue is, that when it resets/alters its snap information, it selects an arbitrary terrain out of the 9 available, which is not necessarily the piece of terrain it is actually on top of.

    For example, if the snapped tree is on a terrain piece with a height of 0, but the arbitrarily selected terrain piece has a height of 100, the tree will stay in the correct X-Z location when it is saved, but it will act like it is snapped to a height of 100, which reflects it's relative position on the arbitrarily chosen terrain.

    NOTE: This does not happen to all snapped-to-terrain objects: Trees with no terrain walls/Big height changes next to them are normally fine and unaffected. This usually occurs when a tree is close to some big change in elevation, like a cliff. I'm guessing you put some code in somewhere to handle this kind of situation, and that your handling code chooses whichever terrain happens to be stored in some LevelEditor class (Potentially such as m_terrain stored in LE_GUI3dTerrain or a similar class). However, since my edited version of the MRLE keeps track of 9 terrains rather than 1, an arbitrary terrain is selected there and being used.

    Here are image examples:

    As you can see, terrain-snapping trees in open areas snap fine, and are saved normally. When I place a tree near a steep elevation change, at first it snaps and works fine while in the editor.

    (Before saving. I place the trees, and they snap normally, even while close to a steep incline.)
    upload_2019-9-8_15-14-28.png

    upload_2019-9-8_15-18-2.png



    However, somewhere in the process they are getting associated with a terrain reference that belongs to one of the OTHER 8 terrains.

    When I Save the data, exit, and reload, this happens to the trees near the steep incline:

    upload_2019-9-8_15-12-45.png

    upload_2019-9-8_15-11-17.png

    upload_2019-9-8_15-13-8.png

    In the above 9 terrain sectors, I set the other 8 sectors to a constant and higher elevation. The trees that are "affected" think they are associated with one of the other 8 terrains, and jump to the relative position that is that height.

    Where can I find the reference to the Unity Terrain / heightmap that is being used here?

    I have code/systems to decide which terrain to use, and I have code to access the list of them from anywhere. However, I am not sure where where in the code this "Random selection" of a piece of terrain used for snapping is happening: Do you know where I can find this?


    Thanks!
     
  15. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    I have more information on the issue: It is actually happening on Loading, not saving like I thought!

    I increased the center terrain's height to be even greater, and had the other 7 terrains at the high elevation they were at before. I loaded the same 9-sector multiple times, with the trees jumping to these unnatural floating positions. Sometimes on a clean load they would all jump to the center terrains height, but sometimes, some of the trees would jump to the height of one of the other 7 non-center and non-southeast sectors. This means that it is being decided arbitrarily for each at load time, not when I save it!

    Additionally, I looked, and no Key-Value pairs were being saved, so all of this is being determined on load, not on save like I thought. Any ideas where I can find which terrain is being "selected" on the loading snap code?

    Thanks!
     
  16. FPVFreerider

    FPVFreerider

    Joined:
    Jun 8, 2015
    Posts:
    2
    FreebordMAD: First of all thanks for a great asset!

    For the longest time I was using an old version of Unity (5.4.1) and your level editor always worked flawlessly. Now I had to start using the latest version of Unity (2019.2.1) due to google play stores new requirements.
    Unfortunately I have encountered a strange issue which I cannot find a solution to:

    Now, whenever I click the "Create Terrain" in the level editor, a terrain is created, but the base texture is not applied. (Instead there is only sort of a checkered pattern on the terrain).
    If I then go the Paint Terrain tab in the level editor and add a second texture, that texture is applied to the terrain. However it also throws an error ("Terrain Layers cannot be populated at the same time as the splats"). (If I continue to add several more textures that error comes up every time).
    I hope you can point me to a possible solution to this.
    Thanks in advance!

    (edit: Tried Unity 2019.1.0 and it does not have this particular "checkered pattern" issue, however it still throws the error when adding more textures, and that version of Unity has several other issues which makes it a worse alternative overall).

    (edit2: Got closer to a solution by adding the Terrain/Diffuse, Terrain/Standard and Terrain/Specular to "Always Included Shaders" in Player Settings>Graphics.
    Now it does not throw the error when I add textures in an android build (When running in the editor it still throws the error).
    However, The base texture is still not applied when clicking "Create Terrain". There is only a plain white terrain. Only when adding a second texture, that second texture is applied to the terrain.

    (This leads me to believe that this issue possibly has something to do with terrain shaders, or the CreateTerrainGameObject method in Unity 2019).
     
    Last edited: Sep 23, 2019
  17. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    FreebordMAD likes this.
  18. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    Hello! I have a quick concept-related question this time!

    So, I noticed that when I make the terrain-painting brush locks onto a grid when you paint. The units seem to be small so that they don't affect larger terrain changes, but when I make small platforms, the grid-locking of the brush can be seen to affect the shape/curve of the terrain, such as with the example below:

    (The terrain here was created in the MRLE, and has not been smoothed out with the smooth tool yet)
    upload_2019-9-24_16-43-9.png

    If I want players to be able to create smoother details for small "platforms" of terrain, how do I do this? Is it related to the heightmap resolution, or is it just related to a grid constraint that is set on the terrain painting brush? How would I alter/remove this constraint if I wanted to?

    Thanks!
     
  19. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Try increasing the height map resolution - the brush snapping depends in the resolution.

    As clarified on mails, I have some hardware problems with my laptop. Will reply soon. Laptop is back online and I'm installing Unity 2019.2.6f1 to check with the newest version.
    [EDIT1:] I can reproduce both of your errors
    [EDIT2:] To fix the initial texture not loading add the below code to the LE_LogicTerrain class in the CreateOrRecycleTerrain method just below p_terrainData.splatPrototypes = baseTextureSet;
    Code (CSharp):
    1. #if UNITY_2019_2_OR_NEWER
    2.             // fully cover terrain with the initial texture - was default before Unity 2019.2 (tested with 2019.2.6f)
    3.             float[,,] alphamap = new float[p_terrainData.alphamapWidth, p_terrainData.alphamapHeight, p_terrainData.alphamapTextureCount];
    4.             for (int x=0; x < p_terrainData.alphamapWidth; x++)
    5.             {
    6.                 for (int y=0; y < p_terrainData.alphamapHeight; y++)
    7.                 {
    8.                     for (int z=0; z < p_terrainData.alphamapTextureCount; z++)
    9.                     {
    10.                         alphamap[x, y, z] = 1f;
    11.                     }
    12.                 }
    13.             }
    14.             p_terrainData.SetAlphamaps(0, 0, alphamap);
    15. #endif
    [EDIT3]: To fix the error "Terrain Layers cannot be populated at the same time as the splats" replace the LE_LogicTerrain.AddTerrainTexture method with the one below:
    Code (CSharp):
    1.         public void AddTerrainTexture(Texture2D p_texture)
    2.         {
    3.             if (m_confT.TerrainTextureConfig != null)
    4.             {
    5.                 if (m_GUI3dTerrain != null && m_GUI3dTerrain.TerrainManager != null && m_GUI3dTerrain.TerrainManager.TerrainData != null)
    6.                 {
    7.                     int textureIndex = GetTextureIndex(p_texture);
    8.                     if (textureIndex >= 0)
    9.                     {
    10. #if UNITY_2019_2_OR_NEWER
    11.                         TerrainLayer[] layersOld = m_GUI3dTerrain.TerrainManager.TerrainData.terrainLayers;
    12.                         TerrainLayer[] layersNew = new TerrainLayer[layersOld.Length+1];
    13.                         System.Array.Copy(layersOld, layersNew, layersOld.Length);
    14.                         layersNew[layersNew.Length-1] = new TerrainLayer();
    15.                         layersNew[layersNew.Length-1].diffuseTexture = m_confT.TerrainTextureConfig.TERRAIN_TEXTURES[textureIndex];
    16.                         layersNew[layersNew.Length-1].tileSize = m_confT.TerrainTextureConfig.TERRAIN_TEXTURE_SIZES[textureIndex];
    17.                         layersNew[layersNew.Length-1].tileOffset = m_confT.TerrainTextureConfig.TERRAIN_TEXTURE_OFFSETS[textureIndex];
    18.                         m_GUI3dTerrain.TerrainManager.TerrainData.terrainLayers = layersNew;
    19. #else
    20.                         SplatPrototype[] splatTexturesOld = m_GUI3dTerrain.TerrainManager.TerrainData.splatPrototypes;
    21.                         SplatPrototype[] splatTexturesNew = new SplatPrototype[splatTexturesOld.Length+1];
    22.                         System.Array.Copy(splatTexturesOld, splatTexturesNew, splatTexturesOld.Length);
    23.                         splatTexturesNew[splatTexturesNew.Length-1] = new SplatPrototype();
    24.                         splatTexturesNew[splatTexturesNew.Length-1].texture = m_confT.TerrainTextureConfig.TERRAIN_TEXTURES[textureIndex];
    25.                         splatTexturesNew[splatTexturesNew.Length-1].tileSize = m_confT.TerrainTextureConfig.TERRAIN_TEXTURE_SIZES[textureIndex];
    26.                         splatTexturesNew[splatTexturesNew.Length-1].tileOffset = m_confT.TerrainTextureConfig.TERRAIN_TEXTURE_OFFSETS[textureIndex];
    27.                         m_GUI3dTerrain.TerrainManager.TerrainData.splatPrototypes = splatTexturesNew;
    28. #endif
    29.                         m_doRebuildTerrainTab = true;
    30.                         // notify listeners that the level data was changed
    31.                         if (LE_EventInterface.OnChangeLevelData != null)
    32.                         {
    33.                             LE_EventInterface.OnChangeLevelData(this, new LE_LevelDataChangedEvent(LE_ELevelDataChangeType.TERRAIN_TEXTURES));
    34.                         }
    35.                     }
    36.                     else
    37.                     {
    38.                         Debug.LogError("LE_LogicTerrain: AddTerrainTexture: could not find given texture in TerrainTextureConfig!");
    39.                     }
    40.                 }
    41.             }
    42.             else
    43.             {
    44.                 Debug.LogError("LE_LogicTerrain: AddTerrainTexture: LE_ConfigTerrain has no TerrainTextureConfig set!");
    45.             }
    46.         }
     
    Last edited: Sep 26, 2019
  20. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    @FPVFreerider please check the above code fixes and revert if it solves your problems, I will then update the main package on the Asset Store.
     
    Last edited: Sep 29, 2019
  21. FPVFreerider

    FPVFreerider

    Joined:
    Jun 8, 2015
    Posts:
    2
    @FreebordMAD Great, that fixed it! Thank you for your support.
     
    Last edited: Sep 26, 2019
    FreebordMAD likes this.
  22. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    I'm having a strange problem with some of the image textures in the level editor.

    upload_2019-10-8_11-20-58.png

    For some reason, some of the items in the object selection area are appearing like that when the game is built. It is not happening while playing the game in the editor, just in the build. Do you have any idea what could be causing this? The particular images that are affected like this have the correct image, not the jumbled mess you see here.
     
  23. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Hi, thanks for using the MRLE.

    Try adding all these textures to the resource folder. Please keep me posted if it did the fix.

    EDIT: cool skin by the way
     
  24. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    They are in the resource folder.

    upload_2019-10-8_14-5-47.png

    I was not having a problem with this before. Is there some limit to the amount of objects that can be added to the level editor or could this be a problem with an object that has animations?

    I would just like to add on that I'm in Unity 2019.10f2
     
    Last edited: Oct 8, 2019
  25. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    I can't seem to find any obvious differences between images that are working and those that are not. Moving the image out of the project and back into it without the previous .meta file does change the image, just to another garbled mess of colors. How can I regenerate the image and see if that fixes the problem?
     
  26. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Check step 3 in the documentation below.
    http://www.freebord-game.com/index....time-level-editor/documentation/level-objects

    If I understand you right, then it doesn't happen in the editor, but it does happen in the build. I suggest that you check the Unity Editor log directly after building. Search for the texture name you need. See if it says included with XY kb size.

    Also, please check if the texture path on the object is really correct. See what the object map checker says on the object map (guide above). To rerender the icon delete the icon path saved in the LE_Object script of the prefab.

    One last item I can think of is that you check if the texture import setting are the same especially for the platform you built for.

    Revert when you have checked all the above.
     
  27. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    Hey @FreebordMAD

    I'll try your next set of suggestions. As for the log, I believe that it is completing correctly, I'm certainly not getting an obvious build failure. This is for one of the .png files that are having a problem :

    Updating Assets/...(correct path omitted).../Eq_2.png - GUID: ff6e3ecbf709e674ea5d9735ec39fe85...
    done. [Time: 66.330500 ms]

    As for the texture import settings, I believe by default that images generated are set to Editor GUI and Legacy GUI. I tried changing it to Sprite but that did not seem to fix the issue. I'm going to go get the images regenerated completely through step 3 in the link you sent me and see if that fixes my issue. Do you think this could potentially be a library folder corruption issue?
     
  28. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    I was trying your solution about regenerating the object icons and I am getting this error:

    Failed to generate preview for object prefab 'Eq_4-1' at index '7'!
    UnityEngine.Debug:LogError(Object)
    LE_LevelEditor.Core.LE_ObjectMapInspector:RenderPreviewIcons(LE_ObjectMap) (at Assets/LapinerTools/LevelEditor/Scripts/Core/Editor/LE_ObjectMapInspector.cs:221)
    LE_LevelEditor.Core.LE_ObjectMapInspector:OnInspectorGUI() (at Assets/LapinerTools/LevelEditor/Scripts/Core/Editor/LE_ObjectMapInspector.cs:50)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Yet a .png is getting generated and seems to be fine though it is still having the same error in the build.

    A similiar error is occuring for the other pngs that are not displaying correctly
     
    Last edited: Oct 10, 2019
  29. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Sorry to hear it didn't help.

    Two more ideas from my side:

    1. Copy your whole project and then remove most objects and leave only a few on the object map including those causing the problem. If it still doesn't work, then try to use these objects in a stock MRLE project - this project you can sent to me and I should then be able to reproduce your issue (currently I don't know what to fix)

    2. Try to delete the whole Library folder - do a backup. Then build again
     
  30. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    I'll try those next suggestions and see if anything helps. Quick question though, where is the particular section of code that loads those thumbnails into the object menu? I was just wondering if there is some read error occurring when either the .png file is being read or the image component's image is being set.
     
  31. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Here are the code details:
    * the resource path of the icon texture asset is saved in LE_Object.IconPath
    * the texture is loaded via Resources.Load in LE_ObjectPrefabNode.uMyGUI_TreeBrowser_InitNode method - the LE_ObjectPrefabNode script is attached to the uGUI prefab of each item in the list
    * the image is generated by the LE_ObjectMapInspector.RenderPreviewIcons method via AssetPreview.GetAssetPreview
     
  32. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    I have some more details that may help:

    - This problem does not occur in another project with the same assets.
    - This problem does not occur when the affected scene is the only one in the build of the game.

    Is this a memory issue or an corruption from another scene?

    Edit - So through a lot of trial and error it seems that having my game's main menu scene in the build settings causes the issue to occur for some reason. I'm still checking if its the specific load sequence (main menu > level editor) or if its simply the presence of the scene in the build. Do you have any idea why a scene with no connection to the level editor scene (minus a Scenemanager.loadsceneasync) would be causing this sort of issue?
     
    Last edited: Oct 14, 2019
  33. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Sounds like a confused Unity resource loader, could be caused by duplicate GUIDs, which Unity should detect itself or simply too many texture assets being in memory of the graphic card.

    To release the graphic card's memory. Try to load an empty scene before loading the level editor scene. In the empty scene call Resources.UnloadUnusedAssets, then load the actual level editor scene.
     
  34. MJDevsGames

    MJDevsGames

    Joined:
    Jan 9, 2019
    Posts:
    36
    @FreebordMAD

    Hello! Quick question today:

    I've noticed that the MRLE seems to randomize the surfaces heights slightly when we use the tools. For example, when I use the Set Height tool, not all of the points are at the same height; There are tiny dips and bumps, which was probably done to add more realistic design to the terrain.

    upload_2019-10-14_16-55-25.png

    How do we turn this feature off if we want?

    Thanks!
     
  35. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    I'm not aware of any code making the terrain rough on purpose. Have you set amount to max value? Is your brush full white?
     
  36. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    That's something I've certainly never heard of happening. I'll try that next. Question though, would that happen even if the (main menu) scene in my case didn't have many assets/textures to speak of? I only have about 20 models in that scene minus a bunch of fairly simple UI elements. In the event that this is not the solution, what else do you think could be happening? I can certainly say that there are many assets that have been added to the level editor in my project. Is there a way I can get around this problem?

    Edit - Don't know if this will help, but I tried putting the level editor scene higher up than the main menu (so it is still in the build) and everything seemed to work fine in that instance
     
    Last edited: Oct 15, 2019
  37. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    Last edited: Oct 15, 2019
  38. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD That was the exact problem I was experiencing. While I didn't use the solutions on that linked forum post, I did figure out that just moving the 'Objects' folder (where all the prefabs for the object selection are stored) out of the Resources both fixes the problem and still works correctly in the built version of the game I'm working on.

    This is probably a much rarer issue that some of the posts on here, but maybe if someone comes over this one they can at least save two weeks of time hunting around for a problem that makes no errors in both the build and the console.

    Summation of issue -

    All 'Resources' folders within a particular Unity project cannot exceed 4GB due to a limitation on Unity's side of code at this particular time. Solution involves removing assets from the Resources folder in one way or another. Potential solutions can be found in a link of one of my posts just above this one.
     
    Ony and FreebordMAD like this.
  39. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Thanks for sharing the solution. I learned something new!
    Glad it works for you now
     
  40. Commandermartin

    Commandermartin

    Joined:
    Nov 8, 2014
    Posts:
    29
    @FreebordMAD

    Do you have an email address we can discuss something over?
     
  41. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Check private message
     
  42. tim44

    tim44

    Joined:
    May 15, 2019
    Posts:
    24
    I'm trying to get this working in VR. I see LE_InputDeviceTouchscreen.cs and LE_InputDeviceMouse.cs. Would adding a VR Input Device be really difficult? VR uses raycast from the controller.
     
  43. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Hi and thanks for using MRLE!

    I know that it is possible some users did it already and I have seen some demos using the MRLE in VR. You have correctly identified the starting point classes. However, you definitely need to have some coding skills to do this.
     
    mfleurent likes this.
  44. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,915
    Edit: Figured this out, but leaving the question in case anyone else has trouble. The problem was caused because I had the wrong "TerrainTextureConfig" assigned in game mode. It was assigned to a blank one and it all works fine in the Editor, apparently, but when it comes to loading outside of the Editor, have to make sure it's pointing to the correct config.

    Original question:
    *******************************************

    I'm having some trouble with loading levels into my game. They load just fine into the Level Editor, but trying to load them in game is causing problems with the texture array. I'm using compressed levels, btw.

    Here's my loading code which I pass the savedLevelStr string to:

    Code (CSharp):
    1.  
    2. byte[] outputbyte = Decompress(savedLevelStr);
    3. string _levelCombined = System.Text.Encoding.UTF8.GetString(outputbyte);          
    4.  
    5. //Debug.Log(_levelCombined);
    6.  
    7. string[] dataAsStringArray = _levelCombined.Split('#');
    8.  
    9. dataAsByteArray = System.Convert.FromBase64String(dataAsStringArray[0]);
    10.  
    11. LE_SaveLoadData level = LE_SaveLoad.LoadLevelDataFromByteArray(   dataAsByteArray,
    12.  
    13.    // pass '0' to put the terrain in the 'Default' layer. Something like LayerMask.NameToLayer("Terrain") is also possible
    14.    0,
    15.    TERRAIN_TEXTURE_CONFIG.TERRAIN_TEXTURES,
    16.    TERRAIN_TEXTURE_CONFIG.TERRAIN_TEXTURE_SIZES,
    17.    TERRAIN_TEXTURE_CONFIG.TERRAIN_TEXTURE_OFFSETS);
    18.  
    19.  
    20. // call this function to destroy level editing scripts and improve performance
    21. LE_SaveLoad.DisableLevelEditing(level);
    22.  
    23.  
    When I run this, the level first loads up just fine. All the prefabs load, etc. Then it crashes with several of the following error:

    LE_SaveLoad: LoadTerrainAlphamaps: the passed texture set seems to differ from the texture set passed to SaveCurrentLevelDataToByteArray! Texture index '0' is out of bounds! Texture will not be loaded!

    When the level loads, it changes all of the terrain textures in the level terrain to the same texture. It doesn't do this if I load the level into the Editor (I'm using the MRLE FileChooser add-on for that, btw). In that case everything works just fine. The terrain being used is the exact same one in both cases since I'm using one scene for the whole game. It only happens when I use the code above to load the level into my game.

    Any ideas on what I should look for here? (Edited: I figured this out and edited the top of this post, but in case you find yourself down here trying to help, it's all good, thanks!)
     
    Last edited: Jan 13, 2020
    FreebordMAD likes this.
  45. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    @FreebordMAD How is the terrain brush projector controlled? I'm trying to get MRLE working on consoles, the Switch at the moment, but I can't control the brush projector.

    Edit: Nevermind I have it working now.

    On another note, if I wanted to select an item and click to place it rather than drag and drop how would I do that?

    Thanks
     
    Last edited: Jan 13, 2020
    FreebordMAD likes this.
  46. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Good to hear you figured out the first one.

    To place on click check LE_GUI3dObject.UpdateNewObjectDragAndDrop from there the method LE_GUI3dObject.PlaceObject is called, which in turn simply executes the LE_CmdPlaceObject command.
    The LE_CmdPlaceObject is very straight forward, so you need to make sure that UpdateNewObjectDragAndDrop behaves as you need e.g. not showing a preview at all and that the LE_CmdPlaceObject command is called upon clicking with the mouse.
     
    Ony and derkoi like this.
  47. electricpunch

    electricpunch

    Joined:
    Feb 18, 2014
    Posts:
    18
    Hello. I have a question about camera controls in level editor. Your MRLE is very cool, but mobile controls are very inconvient, so I decided to use this asset for camera controls: https://assetstore.unity.com/packages/tools/camera/mobile-touch-camera-43960
    I'm making changes in your LE_ExampleEditor scene. Firstly I unchecked IS_CAMERA_MOVEMENT option and thought that it completely disables your camera input code. But seems that it doesn't. When I'm trying to zoom in or out with "Mobile Touch Camera" asset - it zooms much faster than should and when the camera is too far from terrain - it moves to random position. Please explain how to disable all your camera-related code. And please check the video: when LE_LevelEditor_Main enabled - zoom feature is weird. https://drive.google.com/file/d/1Gvu8sycjpi1uZnBN4-hP00rYAQe7aIZK/view?usp=sharing
     
  48. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Sorry for the late reply.
    I'm wandering about this behaviour, because the line
    Code (CSharp):
    1.             if (!IS_CAMERA_MOVEMENT) { return; }
    should disable the camera movement in all places like LE_IInputHandler.MoveCamera, LE_IInputHandler.RotateCamera and LE_IInputHandler.RotateCameraAroundPivot of the LE_LevelEditorMain class. You could double check that this code is not changed.

    Could it be that you have attached the ZoomCamera script to something?

    You can check how to work with Disabled Camera and MRLE in the LE_ExampleDungeonEditorGame scene.

    Does anything of the above solve your issue?
     
  49. Scourge

    Scourge

    Joined:
    Jan 2, 2013
    Posts:
    8
    Hello FreebordMAD,

    I just purchased your asset and now set to create amazing things with it :)
    Thank you for creating such an awesome tool for all of us!

    But first of all, a compile error in Unity 2019.3:
    Assets\LapinerTools\LevelEditor\Example\Scripts\InputAndCamera\Joystick.cs(4,26): error CS0619: 'GUITexture' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'


    Edit: I haven't managed to resolve it, I found these instructions but seems to be obsolete for 2019.3.

    Just a note for those who are experiencing the same issues in the new update.

    2019.3 seems relatively new, but I hope this asset will be maintained from time to time to support later versions of Unity.

    Cheers!
     
    Last edited: Feb 17, 2020
    FreebordMAD likes this.
  50. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    Thanks for sharing your solution, I will add this in the next update.
    [EDIT:] just read your edit, do you still have this issue?
    [EDIT2:] just installed Unity 2019.3.1 and could reproduce your issue - I will check how to resolve it this week
     
    Last edited: Feb 17, 2020
unityunity