Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Auto Fence Builder [Released]

Discussion in 'Assets and Asset Store' started by Two_Click_Tools, Oct 18, 2014.

  1. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hey Guys

    Auto Fence Builder has just been released on the asset store:

    https://assetstore.unity.com/packages/tools/level-design/auto-fence-wall-builder-23201



    It's a tool for both designing fences, and for laying networks of them across your ground/terrain.

    Its main goal was to see if it was possible to reduce this fiddly time-consuming task down to a few simple clicks, e.g. to put a perimeter fence around a terrain of any size can be done in four clicks, with the fence adapting to the contours of the ground.

    The design inspector lets you choose from presets; build a new one from component parts; or even randomize the whole process to get a new Frankenstein fence. After laying the fence it remains fully editable, both in terms of appearance and in moving/reshaping the layout.

    We've included a long pdf manual, but hope it isn't really necessary as it's just a matter of shift-clicking in your scene view to build fences.

    It's an initial release, so hopefully people will find it a useful time-saver, but also see potential for other features.
    We're just a two-man team, so would love to get feedback in case we've missed something that could improve it!

    --------------------------------------------------------------
    January 2016 Updated to Version 2.1:

    Vastly expanded design & components options.
    Now equally at home with walls, not just fences.
    Drag & drop your own Game Objects to use as any components in the fence or wall

    Can also be used as a very fast general-purpose object-placement tool for click-adding any Game Objects to your scene, with the benefit of smart alignment, orientation and scaling.

    Stepping through some of the presets (no audio)


    ------------------------------------------------------------
    Parallel Walls:

     
    Last edited: Jan 1, 2022
    shkar-noori likes this.
  2. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Nice one, reminds me of railclone plugin for 3dsmax :)
     
  3. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Thanks, just took a look at that, looks like a great plugin :)
     
  4. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    It prety much started as a fence creator plugin but evolved to a full procedural modeling plugin with a node editor. I am sure you can find many ideas there for your future developement, cheers!
     
  5. ctalmeida

    ctalmeida

    Joined:
    Sep 3, 2014
    Posts:
    13
    Hi, just bought this, when I try to create a build I get this

    Assets/_IMPORTED/Auto Fence Builder/Scripts/AutoFenceCreator.cs(2,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly

    Any idea what to do here?

    Thanks
     
  6. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    Does your asset work with 2d images/sprites? like ferr2d. And can it be used to procedurally generate stuff.
    I'm actually thinking about castle building with this.

    Thanks. ;)
     
  7. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Sorry to hear you've had an issue. Can you confirm that this _only_ happens during a build?
    We hadn't seen this before, but since reading your post we've tracked down the culprit and will have a fix ready tomorrow. If you could send us an email at the support address in the readme or manual, we'll send you an update straight away.

    Thanks
     
  8. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    @Kiori Thanks for your interest, and good questions!
    At the moment this doesn't use the 2D system, it's purely a 3D modelling utility. As such it's an editor design tool only and has no runtime component which would be necessary for procedural generation in-game. Also, castle walls would require mitering at corners which fences don't require.

    It's really good at fences ;), but best to be clear and say it's not a general purpose procedural generator.

    -------- Edit --------
    Since v2.0 we're glad to say it's now very much more a general purpose tool, and is ideal for castle building! :)
     
    Last edited: Jan 23, 2016
  9. ctalmeida

    ctalmeida

    Joined:
    Sep 3, 2014
    Posts:
    13
    Sorry
    Sorry, what is the support email.
    I can run the game in debug, error just shows when I try to build it.
    I have removed your asset and I can build again.
     
  10. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    twoclicktools at gmail dot com (trying to avoid spam bots)

    Thanks

    Joe
    TwoClickTools
     
    Last edited: Dec 5, 2014
  11. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    *** UPDATE ***

    A bug in a previous build before 1.0.1 could cause build errors, or prevent compilation for Web Player builds. Please email support for a fixed update if this affects you before you can get the Asset Store update.
    Pre-update, if you have your File/Build Settings set to Web Player, setting this to anything else will temporarily resolve the problem.

    Thanks, and sorry for any inconvenience.

    Joe
    TwoClickTools
     
    Last edited: Dec 5, 2014
  12. TheGirlWithTheCrappyTattoo

    TheGirlWithTheCrappyTattoo

    Joined:
    Dec 5, 2014
    Posts:
    2
    Having fun with this, but I just put a fence around a big mountain terrain and it took 4 clicks instead of the advertised twoclicks. Can I have my money back? Just joking ;)

    Is it possible to use my own fence designs inside your asset? I mean use my own parts along with the included parts?
     
  13. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Yes!
    It's not an advertised feature just yet because of the danger of adding a faulty mesh with unpredictable results. But there are some hints in the back of the manual how to do this:

    If you import one of the included .fbx parts ( e.g. a post or rail) into max/maya/cinema/blender or whichever modeling software you use, you can then use it as a template to build your own. You may find the orientation/rotation/scale looks different to what you expect after import, but that's because Unity and the modeling programs have different ideas about up/forward etc.
    If you build or modify your own to follow the template's orientation & scale, once imported in to Auto Fence Builder, it will appear as expected.

    If you find this tricky, or don't have the software to import/export the right format, just email the mesh & material to the support address, and we'll send you back a prefab package that you can just drop in.

    Joe
    TwoClickTools
     
  14. RobertMead666

    RobertMead666

    Joined:
    Dec 7, 2014
    Posts:
    3
    i'm trying to replace a material on the fence posts with my own but when I do it only changes one post. how do I make it change across the whole fence?
     
  15. TheGirlWithTheCrappyTattoo

    TheGirlWithTheCrappyTattoo

    Joined:
    Dec 5, 2014
    Posts:
    2
    OK, thanks, I got them imported but when I use the fence the posts I made in Maya, they appear buried half-way through the ground in Unity, I can fix it by changing ‘Post Height Offset’, but how to I get them to be correct in Maya?
     
  16. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    In Maya, make sure the pivot is in the centre of the base of your post, then they'll automatically align perfectly with the terrain or ground. (For rails, they need to be in the centre of the left edge)
     
  17. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    OK, sounds like you're modifying the already-built fence? (in Current Fences Folder, or the Finished AutoFence folder?). If you change the material on the prefab instead, Auto Fence Builder will use that for all subsequent posts.

    Prefabs are in Auto Fence Builder/Resources/FencePrefabs.

    HTH
     
  18. RobertMead666

    RobertMead666

    Joined:
    Dec 7, 2014
    Posts:
    3
    Thanks, that worked. ( actually, works in all projects except one, but it might be a project issue)
     
  19. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Great :) Remove/re-add AFB to the hierarchy. It sounds like it's just cached the old prefabs.
     
  20. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Update 1.1 is now live. Includes the fixes mentioned previously, and two new fence prefab sets: Concrete Mouldy Panels and Gilded Assassin - an ornate gold carved panel.
    Shown in the post below:
     
    Last edited: Dec 11, 2014
  21. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
  22. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Hi, just wanted to say thanks for this awesome asset. It was always a pain laying out fences. The GUI is very well thought out and every feature works as expected! Definitely a MUST-HAVE asset. Good job!
     
  23. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hey thanks .Rattlehead, glad you've found it useful. I _never_ used to put fences in my games because I was too lazy to line-up every section… I always suspected everybody knew a technique that I didn't. ;)
    Email me if you'd like any designs added, or if you'd like betas of upcoming new features.
    Would love to see a screenshot if you've done something you're happy with.
    Other similar environment building tools coming soon.

    Joe
     
  24. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    does the editor add in mesh colliders to all the parts of the fences that this tool builds? because i don't see any in the finished auto fense folders and i don't want to have the player walk through the fences
     
  25. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hi, at the bottom of the inspector you can select 'Add Colliders'.
    This actually adds Box Colliders - a thin box that spans between each post, rather than Mesh Colliders, as they could have a performance impact with hundreds/thousands of fence sections.
    You must have that switched on when you 'Finish' the fence. If you then select the first rail in the Rails/railsDivided/Rail 0, you will see the green collider box. (Occasionally they might appear on the Post0 instead, it depends what's best performance)

    Collider2.jpg

    collider.jpg
     
  26. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    cool, that makes sense and thanks for the quick reply
     
  27. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    okay, i ran into some issues using the colliders with preset files, also how do i get rid of a preset that i don't like or was created by accident? If you include a collider with a preset fence type, when you create a new fence the editor starts acting badly, the transform handles don't move properly and it doesn't register keyboard or mouse events like should happen normally, everything slows down a lot. the last thing was when a collider is added to the fence you have to add the collider last before you hit finish and start new.
     
  28. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    figured out the presets, in the AutoFencePresetFiles delete the preset, then delete the the auto fence builder from the hierarchy and create a new one.
     
  29. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hmmm, haven't seen this before and can't reproduce it. Could you email support with a step-by-step how to do it, starting from a freshly added Auto Fence. Does this happen only in one particular scene/project, or can you make it happen in a fresh scene? You mentioned 'preset', which one does this happen with?

    Edit:
    If you finish a fence with colliders, then start a new one with colliders and try to cross the fences over one another, you can't place a post exactly where they intersect. The new post will jump either side, or on top, to avoid the colliders on the first fence. Is this what you're seeing?


    Thanks

    Joe
     
    Last edited: Dec 11, 2014
  30. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    Actually if I create a new fence with the add collider checked the move controls are very sluggish as well as keyboard and mouse input events to move around the editor. If I uncheck the add collider before I start making a new fence, everything works fine.
    I made some custom presets with different fence types, white picket fence, and another with dark wood panels, both had add collider checked when I saved the preset. And again unity got very sluggish when I tried to create a new fence and had to shut it down and restart. I'm using the latest 4.6.0f3 build
     
  31. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    •I made a new scene in 4.6.0f3
    •Saved a new preset based on white picket fence with Add colliders.
    •Made a new fence with this preset, all the time with Add Colliders on.
    Did I do this right? Any more steps I need to do?
    Can't make Unity go sluggish, panning zooming still works smoothly with the mouse or arrow keys.
    (Is that what you mean by keyboard input? AFB doesn't use key input, and the only mouse input is adding/moving posts)
    When the fence becomes really large, the ability to move posts becomes sluggish, but nothing else.
    (Because it's recalculating 1000's parts in realtime)
    Does this happen in a fresh scene/project. We could rule out something else in the scene/project, and then find the remedy from there. (New Scene, Add Plane, Add AFB, make fence)
    If you could email twoclicktools at gmail dot com that would be great and we'll get this sorted.
     
  32. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    some of the fences I'm making are very large so that's probable what it is. on keyboard inputs, I use alt a lot to move around the editor and I'm using the middle mouse button to scroll and move the scene around and my scene has a lot of other assets in it already and my unity editor is using a lot of memory right now too.
     
  33. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    okay last question I promise, is there a way to make a T type of fence? I tried the ctrl shift click and that only gives me another transform, and I also tried to click the bottom of the T, then the intersection, then the right end point, then the left end point. That gave me a T, but doubled up all the posts from the right end point to the intersection, rails, and sub posts, which was okay, but I was looking for something a little cleaner.:)
     
  34. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hi Mike, sorry for the delay in replying, I'm on UK time here.
    "last question" . No worries, keep 'em coming… appreciate your interest!
    Yes, there's a couple of ways to do it.
    First, just to clarify, AFB works by shift-clicking a continuous run of fence. A 'T' is most easily done as two separate lines, exactly as you would build a real fence, or by drawing it, or by modelling it.
    BTW, control-shift clicking only allows you to insert a new post connected between two existing ones. It doesn't 'break' a section in to two, which sounds like what you're trying.

    1)You create the top line of the 'T', then press 'Finish & Start New' then continue downwards from the top-centre. :)
    2)Alternatively, you can build the whole thing as one line with the fold you described, 'Finish', then click off AFB in the hierarchy, then in the scene just select & delete the folded parts you don't want.

    Edit:
    V1.2 will support gaps/breaks/discontinuities within a single fence.

    Joe
    TwoClickTools
     
    Last edited: Dec 13, 2014
  35. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
    Hey Joe, no problem on the delay, I'm in Los Angeles so I get that.

    I was just thinking it would be nice if you could... I don't know exactly how, but right click a post and create n-number of branches from that post, that could then be moved independently. Or right click the delete bubble, like under the Show Move/Delete Controls you could have something like "Right Click Delete bubble creates N-number of branches" and the branches are just created to like one post segment in opposite directions, and 90 degrees from the original direction of the posts already in the fence. Then the user could pull the move handles to new positions.

    I'm also getting these messages when I save or the editor auto saves, and I think it comes from AFB, because I wasn't getting them before I added this asset. Any ideas?
    Cleaning up leaked objects in scene since no game object, component or manager is referencing them
    Mesh has been leaked 110 times.

    Again just thinking...
    Anyway thanks for the quick response and help

    Mike
     
  36. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    This is a Unity message about garbage collection. It's pretty pointless, but no harm at all. If you Google it you'll find it occurs in a lot of assets that procedurally create/destroy objects like AFB. I see it myself occasionally, and it seems to go next time you quit and load the scene. Since 4.5 it's seemed more frequent, bit annoying. Unity are saying to ignore it:

    http://forum.unity3d.com/threads/cleaning-up-leaked-objects.6591/
    " This is an internal message related to how we're handling meta data. It's actually a message informing you that some optimizations have been made. One could argue it's not necessary, but for now it's not hurting anything. A simple clear of the Console will get rid of the error."

    As regards your other idea, there's something similar in the works for v1.2. It's not quite the same method, but you can achieve the same branching effect manually. (Not automatically, as AFB wouldn't know which branch gets continued next shift-click) Let me know if you'd like a beta version.

    Joe
    TwoClickTools
     
    Last edited: Dec 13, 2014
  37. Mike Terry

    Mike Terry

    Joined:
    May 6, 2013
    Posts:
    9
  38. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    V1.2 End of December:
    • Global Scale - allows you to scale all parts of a fence instantly, while maintaining correct positions & interpolation.
    Useful if you've customised, say, Rail thickness, and want the choice to scale the fence height with/without affecting Rail width. Also allows giant or miniature fences, while still working with reasonable values like 3m instead of 30 or .03. Can be useful in Physics simulations where larger scales are more accurate.

    • Gaps within a single fence - Allows you to mark sections of fence as gaps while clicking.
    Useful for say, a long road, where you can leave gaps for driveways/obstacles: ----------* *-----------* *----------
    Useful for creating a 'T' or branched section, all in one continuous fence.

    • More prefabs.

    V1.3 January.
    • Secondary Rails - Enables a second different rail type to be used alongside the main ones.
    Useful if you want to design a 'composite' fence with say, one big concrete rail at the bottom, with multiple metal cylinder rails above it.
    Useful for creating non-linear gaps, where you want one rail to be positioned independently of the spacing of the others.
     
    gurayg likes this.
  39. RobHannah

    RobHannah

    Joined:
    Dec 16, 2014
    Posts:
    9
    Hey. When I try to create a prefab from a finalised fence, or copy and paste one into a different scene, the rails lose their connection in the mesh filter component. Is this a bug in the script or something I am doing wrong? Thanks.
     
  40. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hi, I've replied to your email, might be quicker to track it down that way.

    Thanks

    Joe

    EDIT: This was related to _Panel_Rails in Sheared mode and has been fixed in 1.2. Available via email before it hits the Asset Store if needed by anyone.
     
    Last edited: Dec 17, 2014
  41. RobHannah

    RobHannah

    Joined:
    Dec 16, 2014
    Posts:
    9
    Super fast responses and fix. Cheers :)
     
  42. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Auto Fence Builder 1.2

    Happy New Year to everyone!

    1.2 has been submitted to the Asset Store and should be live in a few days.

    This has major code changes so is not suitable for overwriting a 'live' Auto Fence in your scene. It's best to 'Finish & Start New' that instance first. Please remove the old AFB from your project folder then import the update.

    • Gaps Fences can now have gaps and breaks in them, made by control-right-clicking during creation.

    • Create Merged-Mesh Copy This utility is added to your 'Finished AutoFence' folder to enable a permanently merged/combined mesh of each subgroup. You still have the option of using only the runtime combine scripts.

    • Global Scale Scales every parameter simultaneously and proportionately.

    • New Barbed Wire Fence type.


    BugFixes:
    - Prefabs now store own meshes in the case of sheared Panel Rails.
    - Fixed issue with 5 prefab parts not lightmapping correctly.

    Joe

    Two-Click Tools
     
    Last edited: Dec 29, 2014
  43. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Can this be used during runtime?
     
  44. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Hi, not at the moment. It's probably about 6 months away, as there's quite a few other upgrades in the pipeline before this.
     
  45. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    hmm. As the source code is included, I'm thinking about implementing the runtime feature myself. As far as I can see from the video you set the rail with some mouse clicks, which then sets the handles. So I would just have to change those controls and implement the controls form the inspector to my gui system right? If it's "only" that then I would do it myself.
     
  46. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Sorry for the delay in replying… I'm on UK time. Yep, in principle. All the user click-points are stored in a List, but the interpolated and rounding positions are calculated 'live'. When the design of the fence is changed it's effectively destroyed and rebuilt (via a pooling system), but this is fast enough in the editor to feel smooth and instant. The reason we saw it as a bigger job to implement in runtime is that everything's geared for best editor performance (and I guess this applies to many editor tools)
    1) memory constraints -- this isn't really an issue in the editor, and the pooling is just there for speed. But for mobile, some limits would have to be in place for the amount of pre-built stuff
    2) performance -- not tested yet, but the rebuild load would need redistributing depending on how much else is going on in your app.

    There's certainly nothing preventing it, but it's hard to estimate how much work it would be, purely because of performance tuning for realtime. If you want to drop me a line at the support email with an idea of what kind of runtime use you have in mind, I'll give you a more detailed idea of what would be involved. I wouldn't want you to buy it under false impressions. Even if it's not suitable in its current incarnation, I might be able to help you out with code etc.

    Joe
     
  47. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    While I was on the road, I received a mail from someone called, I think, 'Juan' asking about importing a .dae model in to Auto Fence Builder.
    Unfortunately Gmail, in it's wisdom, had put it in the 'Spam' folder, and after returning home, I was unable to locate it again.

    If you could get in touch again, or leave a message here, I can get a solution for you.

    Apologies for any inconvenience.
     
  48. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Unity 5

    For anyone upgrading a project to Unity 5, AFB 1.21 has been tested and works fine. (Allow the automatic API update)
    If you're new to the Pro features and are using Static Batching AND have marked your Finished Fences as 'Static' you may see an issue with the Combine scripts.
    You will need to either 'Create Merged Mesh Copy', or, disable the combine scripts on each sub-folder.
    (This is normal behaviour, static batched meshes cannot be optimised at run time)

    Please get in touch if you need any help with this.

    Thanks

    Joe
     
  49. Two_Click_Tools

    Two_Click_Tools

    Joined:
    Oct 9, 2014
    Posts:
    248
    Fence/Terrain alignment problem in Unity 5.0.0

    There may be an issue with Unity Terrain colliders in 5.0.0 that causes a new fence to be misaligned with the terrain.
    If this happens, just save the scene, then make any adjustment to AFB to make a refresh (e.g. turn Interpolate on/off).

    This seems to have been fixed in the latest 5.0.1

    There will be an AFB update at the end of the month.

    Thanks

    Joe
     
  50. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Hi,
    FYI, in Unity 5.0.1p1 I had to remove "CombineChildrenPlus", this has generated an error after the upgrade from 5.0.1