[Released] Terra Slicer & S.A.M.

A quick warning:

Secondary Cell Object Sub Controllers will become obsolete with the next update. I am introducing a new system that I think is more flexible and intuitive. I doubt anyone is even using secondary sub controllers, so this will probably have little to no effect on anyone, but I wanted to put out a warning just in case!

I posted this on the OP, but wanted to add it here too:

If using a Prefab Instantiator Component, please ensure the prefabs in your Resources folder are disabled. If they are not, the player will see your terrains/other game objects in the wrong position, and the tree colliders on your terrains will not work properly!

Thanks.

Known Issue added to OP

If you enable the ā€œSet Neighborsā€ option when using the Terrain Slicing tool, deleting a slice from the scene after slicing will cause Unity to crash, or produce errors. This may only be an issue with Unity 4.x.

Solution: Either disable this option, or after slicing simply perform any action that causes your scripts to recompile (close/reopen your project, edit/save a script, etc.). This will clear the terrain Neighbors and you should be free to delete the slices without issue.

Hello everyone,

In testing my newest update, I have come up across a couple of Unity 3.5 issues I wasnā€™t aware of before now. As I noted some time ago, when using the Prefab Instantiator component, you need to disable your prefabs in your project hierarchy to avoid tree collider issues, and to ensure the terrain is not shown before it is positioned in the correct spot. However, it turns out you can not set the state of a prefab in Unity 3.5.

My first thought was to just have anyone using 3.5 to use the new Scene loader component that makes use of the Application.LoadLevelAdditive method. Unfortunately, it turns out that this method behaves differently in 3.5 then it does in 4.x. In 4.x the objects in the scenes you load take one frame to initialize (that is, to show up in the scene). This allows you to call Application.LoadLevelAdditive(levelName) in Awake, and then in Start, find the objects loaded from that scene for storage/manipulation (this is what I do in the Dynamic Loading Kit). In 3.5, however, this method takes several frames to work, which makes it less than ideal for my purposes.

What does this mean for you? Basically, I am going to be dropping 3.5 compatibility with the next major update. I suspect that this will impact very few users, as most are probably using Unity 4.x Indie or Pro.

However, if you are using 3.5, please contact me. I am fairly confident I can rework the scripts to support 3.5 use of the Scene Loader components. However, it will take a little work, and if there are no 3.5 users then thereā€™s really no point to bother with it. It will also result in a few less than ideal changes to how the DLK works, which is why Iā€™m not going to implement these changes to the Asset Store version.

Also note, the Prefab Instantiator issues have no solution (although, if not using Trees and if your cell objects are loaded beyond the cameraā€™s far distance, you shouldnā€™t have issues with using it).

I deeply apologize for these issues. Rest assured that any issues will be resolved!

Thanks,

Kyle Gillen

I try to ā€œCreate a World Grid Assetā€ā€¦ and nothing happens?

It should be created in whatever folder you have selected at the time. If no folder is selected, it should be created directly in the ā€œAssetsā€ folder. If you still canā€™t find it, try doing a search in your project hierarchy for ā€œWorldGrid.ā€

If you are still having trouble, please email me at kgillen@deepspacelabs.net

Oh! Right, okay, I assumed it was supposed to be in the hierarchy. Found it thanks :slight_smile:

Glad you found it!

The documentation is not great right now, which I am working on. I actually started writing up some docs a while ago, but then started working on update 2.0 of the kit. Because this update is going to make some things outdated, I decided to forestall writing the guide until it was finished, (which it basically is). I just started rewriting the full guide, and will work on some other stuff soon (as well as videos).

You can check the ā€œDynamic Loading Kit Comprehensive Guideā€ found near the top of the following page if you have any more issues:
Page where Guide can be found.

As I said, itā€™s not actually comprehensive, but perhaps it will offer some quick help to common problems. If not, just post on here again and Iā€™ll try to respond as quickly as I can!

Thanks!

Hey mate, thanks :slight_smile:

Iā€™m following along with your steps on the first page of this thread. I hope Iā€™m understanding things correctly. Iā€™ve placed all my terrain slices in a prefab called ā€œTerrainā€ in a folder called ā€œResourcesā€ which is under Assets, so Assets > Resources.

I moved World Grid in there as well, as it went to my main folder. I set the base name as Terrain, which my prefab is, set it to 4 x 4, which my sliced terrain is, then pressed Update Data.

Now, the column widths, row lengths, etc are saying ā€œNot Setā€ after pressing update data. Is that supposed to fill out with data or should it just remain that way?

Cheers.

Edit: While I donā€™t have the dynamic loading working yet obviously, I have 16 terrains from the slice. Is it normal for it to cause a significant frame rate drop? Meager system went from 60fps to 20fps after the slice.

Youā€™re almost there! Each slice should actually be its own separate prefab rather than being parented to a single prefab. So if youā€™re slices are ā€œTerrain_1_1,ā€ ā€œTerrain_1_2,ā€ etc., there should be 16 separate prefabs in the resouces folder. I will update the steps to make this clearer.

Also, (and this will only work in Unity 4.x), you should make sure all the prefabs are in a disabled state.

The World Grid can be placed anywhere. Itā€™s probably not a good idea to place it in the resources folder, however, because placing it there will mean it is always included with your project build, even if later you decide not to use. Once you add the WorldGrid to your Dynamic Loading Configuration Form component in the inspector, it will be included in your build automatically, so thereā€™s no need to place it in the resources folder.

The resources folder is only for assets which are not referenced by one of the components in the scene. Unity tries to only include assets in your build that are actually used in your game, which means it will only include an asset if it is referenced by some component in a scene that is included in the build.

Sometimes, however, you may have an asset which is not referenced directly, but you still plan to make use of during your game (ex: a texture which will only be assigned to a programmatically created material). Our terrain slices are such assets, as we donā€™t reference them anywhere directly, but still plan on using them. Resources folder to the rescue! Any asset in a folder called Resources (you can have multiple Resources folders) will always be included with the build.

Hopefully that clears up some of the mystery surrounding why we need to use the Resources folder in the first place!

As for the performance, that does not seem quite right. Did you remove the pre-sliced terrain from your scene (make a prefab backup for it before deleting)? Each terrain has its own performance overhead, so thereā€™s a chance the performance would degrade with slices rather than a single terrain, depending on each individual users project. Once you get the dynamic loading up and running, please let me know if the performance improves.

If not, maybe you can send me a copy of your project that only includes the terrain you are slicing (along with any assets it uses)? You can delete everything else from it except for the TerrainSlicing folder. Just duplicate your project folder, then open the new project in Unity and delete all the unrealted stuff. Then zip (or 7zip) it up and send it to the email listed in my previous post.

Thanks and good luck!

Hey mate!

Thanks for running through every thing for me, I really appreciate it :slight_smile:

I placed each individual slice in the resources folder as a prefab (all deactivated before doing so). Then created a new world grid just to be sure (deleted old one). And yeah, essentially it just keeps saying ā€œNot setā€?

Donā€™t mind the numbers, I was playing around with 4/8/16 just to test I suppose. I also tried the base name as just Terrain and Terrain_Duplicate.


As for the performance, Iā€™ve always had a bit of a performance hit in this project (using editor, it usually takes about a second and a half for a click to be registeredā€¦ frustrating). But yeah, the terrains are causing even more performance hit, drastically so. I think it might be wise for me to export my project and import into a fresh one as Iā€™ve had quite a few issues with this project, I just donā€™t know how feasible that right at this moment.

Cheers again for the help :slight_smile:

Okay, so your grid name is actually going to be the common name shared by all of your terrains. In your case, that will be Terrain_Duplicate 1 (with a space between duplcate and 1). Also, it looks like you are using a 4x4 group rather than an 8x8, so change rows and columns to 4 as well.

After that, the Update Data button should work. Good luck!

Oh, right! Worked perfectly. Thank you!

Edit: Sorry, I know itā€™s probably explained but Iā€™m terrible with following guides correctly heh :confused:

Iā€™m getting the following error:

Which confuses me, do I have to add those prefabs to the build setting? is that even possible lol?

Cheers and sorry again!

Looks like you are using a Scene Loader component instead of the Prefab Instantiator one. Remove it and add the Prefab Instantiator instead. You can find it under Componet ā†’ Dynamic Loading Kit ā†’ Cell Object Loaders.

And itā€™s not your fault. The guide is incomplete, as I noted before. So please feel free to keep asking questions!

I am actually working on the new guide for v2.0 of the kit (soon to be released) right now, so hopefully things will be clearer in the future.

Alright thatā€™s all set up. Things seemed to be loading correctly (pressed play, went back to scene mode, dragged my player to a new area and that area loaded), but now, running around to different sections, the terrain doesnā€™t load for some reason. Not entirely sure why.

And Iā€™m still getting the poor frame rate. It only ducks that low with the sliced terrain. I tried exporting but my project just keeps crashing when I go to export prefabs. Must be too bigā€¦ idk.

Edit: Actually, that first problem was solvedā€¦ I had the parent empty game object I store my RFPS player in as the player in the dynamic loader, I changed that to the object with the capsule collider and the terrains load fine now.

I am sorry to hear about the poor performance. Is there any way you could send me a copy of your project?

  1. Find your project on your machine and copy/paste it somewhere.
  2. Open the copy/pasted project in Unity.
  3. Remove everything except for the TerrainSlicing folder(and its sub folders), the base terrain (the unsliced one), and any assets associated with it (trees, textures, plants, etc.). You can remove the slices and terrainData associated with the slices as well. Letā€™s try to make the project as small as possible.
  4. Compress the folder.
  5. Send it to kgillen@deepspacelabs.net

Thanks!

Hey mate,

Iā€™m just going to try manually moving everything over into a new project as I was having a lot of unrelated issues anyway, and my project was pretty bloated with a lot of unnecessary assets. Iā€™ll see how I go with this and report back :slight_smile:

Okay.

I sent you a private message as well; please take a look at it when you get the chance and respond back (via PM) at your earliest convenience.

Thanks!

Hello. Thanks for the great solution:) On your website, it says

ā€œNote: I am working on some major updates that will make some of the information in this guide irrevelant. I will start updating the guide once these updates are completed!ā€

Will the new update possibly break compatibility with older version of the kit? In that case, I want to wait implementing map feature for my game till the update comes out. Do you have any ETA?

Hello noanoa,

Yes, it will break compatibility, in a major and minor way.

First, the major. I have found while working on the latest update that the kit isnā€™t really compatible with Unity 3.5. To be clear, itā€™s not that the update that has made it incompatible; it turns out there was always a small quirk that I only recently discovered that makes it so. Because of this discovery, I am changing the kit to require 4.0 or above.

For 3.5 users, this means you should avoid the upgrade. If you really want/need it, please contact me about a possible solution.

As for the minor break in compatibility, the Dynamic Loading Configuration Form component has been removed in the new update, and replaced by three new components. When you download the update, there will be a button on the Dynamic Loading Configuration Form that you can press to add the new components and remove the form component.

Using this button will automatically configure the new components with any settings from the form component that apply. It will also remove the Active Grid Resetter component (which is now obsolete). You should look over the three new components (World, ActiveGrid, and ComponentManager) to make sure they are configured how you like. These changes also mean that any player prefs data you have for the kit will be obsolete, as a new player prefs format is used with the new update.

Also, I have made some changes to the WorldGrid class that will require everyone to reset the their WorldGridā€™s data.

Finally, secondary sub controllers have been removed, but I very much doubt this will effect anyone (if it does, contact me for possible workarounds).

As for the release, I am done with the actual update and am now working on documentation. The new full guide is almost complete, and once thatā€™s done Iā€™ll add it to the kit submit the entire thing to the Asset Store.

So, it will probably be a week or two before the update is available. If you wish to get the update early, you can do so by contacting me via email with your Invoice number.

Thanks for the interest!

-Kyle Gillen