Search Unity

[RELEASED] Snap-and-Plug: join anything to anything

Discussion in 'Assets and Asset Store' started by a436t4ataf, Sep 15, 2014.

  1. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I had a request for the API docs today (source-level documentation explaining every method, every parameter, etc -- useful mainly if you want to customize / integrate with other code, or if you want to make a proprietary in-game snapping system based on this).

    So I've updated all the API docs and exported as HTML. If anyone needs this *now* then email me directly, otherwise I'll post back here once the website is back online with the latest docs included.
     
  2. contactRVR

    contactRVR

    Joined:
    May 28, 2018
    Posts:
    1
    Hey Adam !

    I've just bought your plugin and I saw your last post on the unity forum.
    Is-it possible to have access to the API docs ?

    Thanks !
    Francois
     
  3. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    (done) - docs seem to be fine, so I'll try to get them online over the weekend.
     
  4. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Update: the website is now back online, with a lot of help from Archive.org (all the missing images recovered thanks to their awesome archiving system!).

    I will upload the API docs very soon, probably in the next few days (just need to make a few tweaks based on feedback from some of the people who emailed me).
     
  5. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
  6. computerking9979

    computerking9979

    Joined:
    Sep 2, 2018
    Posts:
    12
    Are there any instructions for how to use the in-game snapping? I'm playing with the demo scene but can't really make heads or tails of what is needed to replicate it.
     
  7. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    You're welcome to ask questions here about any of the three in-game snapping approaches and I'll answer them. I'll then copy/paste my answers and use them as the starting point for a new chapter in the manual :). A lot of it has evolved in response to alpha and beta testers (trying it out with different types of game), so I've had to keep adapting the design - I didn't design it 100% up front.

    Briefly: There's three different ways people are doing in-game snapping using SnapAndPlug. You can do it with your own custom UI (the car-builder demo works like that - everything built custom), you can re-use the UI scripts included in the demo-scenes (e.g. take the car-builder scripts for drag/drop and tweak them for your game), or there's the 99% automated, new, DragDropAction3D system which I've been using in my own projects recently and a few people have been beta-testing.

    (The automated system has more code than the rest of this asset put together :). The upside is that you can use it with no code changes, or a few customizations, or lots of customization and it adapts to all those situations. It's a lot easier for making in-game snapping in any way you want (it adds features to Unity MonoBehaviour etc that make it mostly automatic). The downside is that documenting and maintaining it is a lot more work for me. The first alpha test was more than a year ago, and it's not finished yet!)

    I am currently making it into a separate asset aimed at wider audience (who don't need all the low-level features of SnapAndPlug). So ... you might want to wait for that (And email me so I can add you to the beta test for it!). Or ... go ahead and ask about the other approaches and I can explain whatever bits are unclear.
     
  8. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    v2.3.0 is now in Review.

    This is the version that most of the beta-testers have been using. It enables the new modular scripting system for in-game snapping (based on DragDropAction3D), and includes a new Demo Scene showing how to setup in-game snapping with just one simple component you drop directly onto any SnapPiece to make it snap in-game.

    Updated docs (with more pictures) are already live on the website: http://snapandplug.com/documentation/

    NB: this is likely to be the last significant release in version 2.x. After this, all features and changes will go into the 3.0 release (a major upgrade, but won't be ready for a long time yet!)
     
  9. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    I must be doing something wrong, or this is broken on 2018.3 / Mac. Just bought it at 2.3.1, so I don't know about prior versions or other platforms. I just care about Edit mode not Play mode. Loaded the SimpestDemo scene. Cannot grab handles in Scene (they disappear/reduce to red hollow squares and I begin a rect-select action instead).

    Edit: Okay, I have a clue what's happening. On a hunch, I positioned the camera such that one of the red handles is near the upper left corner of view, and the hit-testing worked correctly to let me start dragging the handle around. As the handle dragged around, it was always halfway between the upper left corner and my mouse. So it has a pretty common problem with the 5K / High DPI system used on Macs. All the mouse and screen space coordinates in the Editor need to factor in the high resolution:
    * EditorGUIUtility.pixelsPerPoint
     
    Last edited: Apr 1, 2019
  10. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Excellent - thanks! One other person reported this recently, but confirmed it was a Mac-only issue, and I couldn't figure out what had changed in 2018 to break this (used to work fine on Mac).

    I will push out a fix ASAP, but in the meantime - can you email me directly and I can send you a build with the pixelsPerPoint change and you can check it works correctly?

    NB: I am about to leave the country for a conference for the rest of this week, so if I cannot get this fixed this evening, it'll have to wait until next week. No promises, but I'll try to get a build for you today!
     
  11. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Yeah, no problem. Not sure it's a 2018 thing per se, but it's a Mac 5K thing which admittedly is more and more common.
     
  12. spazmantiz

    spazmantiz

    Joined:
    Mar 19, 2019
    Posts:
    2
    Can i use this in unity 2019.1?
     
  13. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    It should work fine in 2019.x. I haven't tried it - I'm using 2018.1 / 2018.2 / 2018.3 for all my projects at the moment - but if anything goes wrong email me directly or post here and I'll fix ASAP.
     
  14. marvin69c

    marvin69c

    Joined:
    Jun 21, 2019
    Posts:
    5
    I just purchased your plugin yesterday. I am running unity 2019.2.0f1 and I started with your documentation on how to get started but as soon as I try to drag the "SnapPiece" onto a cube I get an error that says "Cant add script component "SnapPiece" because the script class cannot be found. Make sure that there are no compile errors and that the file name and class match." Please advise as to what I need to correct so that I can use this plugin.

    So I check for errors and of course there are 6.See attached image. upload_2019-8-23_8-59-35.png
     
  15. marvin69c

    marvin69c

    Joined:
    Jun 21, 2019
    Posts:
    5
    Well I was able to fix this on my own by downloading the standard assets from the asset store because CrossPlatformInput has been deprecated. My issue now as I go through the tutorial is that it says to "Click + hold the mouse button on the red pyramid, and then drag it around your scene view. You'll see a line connecting it to the object it comes from:" I cannot click on the pyramid, it will not select it. I click and hold the mouse button and nothing happens.
     
  16. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I'll check this weekend, but these look like errors outside snap and plug. If SnP is using some of the Standard Assets that should have no effect - unless there is something else in your project that is using / altering them.

    What happens when you create an empty project that only has SnP?

     
  17. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Also there is a problem with Mac retina displays that Unity changed their API in ways that broke all existing code, and I haven't got a retinal dsiplay to test it on - the fix I tried so far hasn't worked.
     
  18. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    NB: it only breaks the in-editor dragging. Game builds work correctly with no changes.
     
  19. marvin69c

    marvin69c

    Joined:
    Jun 21, 2019
    Posts:
    5
    I do have an empty project, my scene is a plane and a couple of cubes to just try the plugin. Also I am not using a MAC retina display so I am unsure what that means. If I cannot select the pyramid to drag and snap then I cannot create the snapgroups. How am I supposed to build a scene without being able to drag my sockets to prove/create snap groups?
     
  20. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Can you email me a copy of your scene (zip the whole folder, without the Library subfokder) and I'll test it over the weekend?
     
  21. marvin69c

    marvin69c

    Joined:
    Jun 21, 2019
    Posts:
    5
    OK. In the scene I am sending you will see that I have the Oculus Integration added which I need to be there as that is what I am building for. I went ahead and tried a complete empty project no SDKs and imported your plugin in. I still got the same errors as I had before. I then imported the Standard Assets plugin from the asset store and that fixed all the errors. However I was still unable to drag in the editor. As I mentioned this is all in the Unity version 2019.2.0f1. I will zip the file without the Library folder and email to you now.
     
  22. marvin69c

    marvin69c

    Joined:
    Jun 21, 2019
    Posts:
    5
    As an interesting side note, I tried to import your plugin into the Unity version 2018.4.5f1 and it did come in without errors and I did not need to import the Standards Assets from the store. However the drag in editor still does not work. BTW I sent the email.
     
  23. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    UPDATE (for everyone else) - I've reproduced @marvin69c's problem, and it's definitely not working in 2019.2, even the latest version of Unity.

    I don't know what the problem is, there's no errors, but I'm looking into it this week and will get a patch out ASAP.
     
    marvin69c likes this.
  24. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Quick update - it appears that some of the code to try and workaround Unity's changes to Mac Retina screens has introduced this problem. I've managed to reproduce on Windows machines with non-100% HiDPI scaling, working on a fix now...

    This affects people with retina screens (or on Windows: people with 4k or 5k monitors - but it depends which emulation mode you're running Windows in, since Windows doesn't have full support for hi-res monitors yet), and only if running a version of Unity with their Retina changes in (i.e. late versions of 2018.x, and all versions of 2019)
     
    marvin69c likes this.
  25. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    FIXED: version 2.3.3 now contains a complete fix for 4k and 5k Windows monitors. I believe this will also fix the problems on Mac Retina screens (I'll be testing that next week).

    This will go to the Asset Store today, and should be available for download early next week when Unity accepts it. If you already have SnapAndPlug, you should get an automatic email from Unity when it's ready to download.

    Any problems (or if you URGENTLY need the patched version), please email me directly.
     
    marvin69c likes this.
  26. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    ...now submitted to Unity (will take 2-5 days for Unity to approve).

    NB: this also contains a fix for the changes Unity made to Standard Assets in 2019.x. There is only one scene that used the Standard Assets, and it only needed an FPSController - now instead of bundling Standard Assets, I have an automated check to see if you have installed SA, and if not, you get an error message telling you to install the latest SA for your Unity version (or you can use your own custom FPSController - it will work with any!)
     
    marvin69c likes this.
  27. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    still waiting to see a V.R example in a SnP update. ( I'm using Oculus Quest now )
     
  28. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I'll email you a beta build as soon as I have something good enough to try :).
     
  29. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hiya, I'd also like to see a VR example, I can't get it to inGameSnap, I'm guessing it's something to do with teh IDragActionSource, as I'm using a custom OVRGrabber so there's no mouse input.
     
    Last edited: Feb 2, 2020
  30. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I have a Quest on order, waiting for it to arrive to do next round of testing/documenting of the VR integration.

    (so far I've only tested with the old Oculus SDK + Rifts, and I want to get things working with the latest Unity VR framework. I figured I could do that at the same time as testing a Quest.)
     
  31. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Update: ordered the Quest from Amazon, an Amazon employee stole the Quest en route, and delivered me ... a small jar of food supplements ($15 worth) instead.

    The good news is that Amazon refunded it same day, the bad news is that now I have to order all over again, and it looks like everywhere is out of stock ... again. Thanks, Amazon! :(
     
  32. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Quick poll: Which callbacks do you need for events happening while the snap is in-progress?

    https://www.poll-maker.com/poll2765846xC5b64Ee5-81

    (someone just asked for one that none of the beta-testers had needed, so I'm checking what else is missing before I go ahead and change this)
     
  33. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I've got most of Unity's new cross-platform VR system working - first VR builds of SnapAndPlug should be within a week (beta testers will get emails in the coming days).

     
  34. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Also been adding some features I've wanted for years - e.g. interactive guides for positioning Sockets on things:

     
  35. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I've just sent an email out to all previous beta-testers, and most of the people I've had support calls with for SAPv2 - if you didn't get it, please DM me / email the support address.

    TL;DR: SAPv3 is coming along great, and if you're using VR right now then I can send you a patch (some features I've backported to SAPv2) that should get you working with VR in your existing SAPv2 build. I'm working with teams on a case-by-case basis to adapt the patch to their project.

    If you don't need VR intergation urgently, I highly recommend waiting for SAPv3 to go live, or for the beta-test coming next month (if you want to be on the cutting-edge). It is much, much better :).

    Note: this is a backport, so it's not seamless - SAPv3 has a redesigned core that copes with VR a lot better, but with SAPv2 all I can do is patch it.
     
  36. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Core VR snapping is finally working, which lets me e.g. pick up and break apart objects, while keeping 3D snapping enabled:



    There's still a lot of bugfixes and polishing to do, and a few more features I want to get in, but I'm expecting to have a decent build (ready to ship) in about 4-6 weeks time.
     
  37. muvisuki

    muvisuki

    Joined:
    Jan 20, 2020
    Posts:
    2
    Dear Representative!

    Please answer quickly.
    I purchased Snap and Plug from unity asset store.
    Using the htc vive pro camera function, the object is jointed by applying Snap and Plug with hand tracking.
    Please let me know if you have any good methods and scripts on how to connect nearby objects together.

    Thank you.
     
  38. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Hi, @muvisuki - which VR framework are you using? e.g. if you're using XR (the new Unity official one) then I have demo/test code for this already. If you're using the old hardware-specific frameworks, I'm not currently testing with those.

    Second question: what are you trying to do? The current version of SnapAndPlug is difficult to get working with VR - I am currently writing a new version that will be ready at the start of next month that is specifically designed to make VR easier to use.

    But if you email me directly - support @ snapandplug.com - I can also send you the latest patches with VR support. NOTE: these aren't fully tested/complete - they are the latest, newest, code, and still have some bugs! - but they work better with VR setups.
     
  39. muvisuki

    muvisuki

    Joined:
    Jan 20, 2020
    Posts:
    2
    Thanks for the quick response. I mailed it directly.
     
  40. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Lots of bugs left to fix, but here's a new project I built over the Easter weekend using the new SAPv3 code. You might recognise some of the legacy SAP features but improved (e.g. the supplied in-game snapping now has modular parameters, so you can easily swap in different algorithms for snapping, movement, control (VR vs mouse), etc - in this video, I used a snap algorithm that only looks at the top-down distance, so you move objects sideways on the plate, and dont have to worry about their height)



    Next beta-test is currently planned for 1st/2nd week of May.
     
  41. yadu

    yadu

    Joined:
    Dec 6, 2014
    Posts:
    9
    Hello, I got the asset some days ago and I've been trying to incorporate into my game. The InGame Snapping Demo that came with the asset didn't have a camera and also did not work, the PlayMode Example Scripts did not have a scene to test them. I managed to put it together and make things work using the InGameSnappable class for now. Is there a way to get some working examples of in game snapping? Also I need use my own scripts for drag/drop and also rotate objects and inspect them before snapping; what is the best approach to incorporating snapping with a system like that? Is that possible?
     
  42. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    All the demos work, but it is a legal requirement from Unity that I am not allowed to ship that demo with the FPS controller embedded. I don't like it, but ... Unity broke it, and I had to change the setup :(.

    When you run the scene, you get a message explaining this, and telling you what you need to do to enable the scene. This month, Unity informally changed the legal status (although they haven't changed the legal docs yet!) and in theory I might be allowed to include the controller again. However, because of bugs in Unity's code (that they introduced with 2019.x), it's not possible for me to include the controller without breaking at least one project - 2018 and 2019 have incompatible versions, and only one can be present in the project.

    (I used to include it for Unity 5, Unity 2017, and Unity 2018, but Unity demanded all assetstore publishers stop doing that, and with 2019 they broke all existing plugins that were using the FPS controller).
     
  43. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    The PlayMode scripts are shared scripts used by multiple scenes, and provided as examples for you to write your own custom snapping behaviour. They show how to access the core SnapAndPlug APIs. This should be explained in the docs - my apologies if it isn't, I may have deleted that section by accident in one of the updates.
     
  44. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    With the current version it's "possible" (I've done it myself a couple of times, on different game projects) but it requires writing a lot of the code yourself - but ... I can make it much easier.

    So: over the last year, I've taken the best code from some of my game projects that build on top of SnapAndPlug, and I've been refactoring it, and using it to rewrite the internals of SnapAndPlug. This is a massive update, and I've been using it to add lots of features I've wanted for ages.

    (current estimate: beta test will start in May - if you'd like to be a beta-tester, email me / DM me on the forums with your email address)
     
  45. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    In the meantime ... feel free to email me (support @ snapandplug.com) and I can advise on the easiest/best ways to implement what you're trying to do, and if I already have code for some of it, I can send you some of my own code.

    TL;DR: SAPv3 (coming soon, probably June) will solve a lot of this, and make it MUCH easier to customize. But it's a heck of a lot of work! So it's taking me a long time to get all the bugs ironed out.
     
    yadu likes this.
  46. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    PS: if you know of any way to embed a full FPS controller - legally! - inside an asset, then I'd love to try it. The main problems are:

    1. Must be legally allowed (so it has to be open-source, creative-commons, or public domain. "free" isn't enough, most free assets are still legally not allowed to be re-distributed)
    2. Must not conflict with other users' game projects (so e.g. Unity's FPS controller either conflicts with 2018, or with 2019 - you can't win :(. You get compiler errors)
    3. Needs to be an easy to use, "typical", FPS controller

    So far the only option I've found is to write a full FPS controller myself. But if I did that I'd have to raise the price considerably :(. I would REALLY like to change this! But I haven't found anything yet that meets the above requirements :(.

    EDIT: 12 months from now: Unity will kill off Unity 2018, and I can then use the Unity 2019 FPS controller. But that's a long time to wait
     
    yadu likes this.
  47. yadu

    yadu

    Joined:
    Dec 6, 2014
    Posts:
    9
    Thanks for the response. Time is something I don't have at the moment :) hence the whole point of investing in systems/plugins etc.. I hoped that this would give me a quick start into what I was hoping to do. I'll send you an email and I hope there is something you can help me with. + would love to be part of the beta.
     
    a436t4ataf likes this.
  48. yadu

    yadu

    Joined:
    Dec 6, 2014
    Posts:
    9
    a436t4ataf likes this.
  49. giuoliv

    giuoliv

    Joined:
    Jan 19, 2017
    Posts:
    3
    Hi, I bought snap-and-plug, but I would need to use it in a 2d game, where the rest of the scripts use box colliders 2d, while this plugin requires normal box colliders (3D), is there any simple workaround to fix this? I am very new into Unity and programming, so please, explain me everything step by step.
    I have seen snap-and-plug 2d tutorial but it is not about colliders.
    Thank you so much!
     
  50. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    None of snap-and-plug requires 3D, but it requires the Unity physics engine (and BoxCollider2D etc *does not use* Unity's physics engine). People making 2D games with Snap and Plug so far have used the full 3D physics engine (in which case: everything works fine) - you can use 3D physics with 2D, Unity is happy with that!

    This isn't clearly documented by Unity (sadly; I think they don't want people to know about it), but you have to choose either 2D or 3D physics when you start your project, and then stick to it. Unity has a button for switching between 2D and 3D but it has never worked properly: it will not switch your physics engine (and Unity doesn't want to fix that because it would cost them a lot of time and effort).

    Why? Because: Unity's 2D physics isn't a full physics system - it's a faster, simpler, cut-down physics engine (if I remember correctly: it's not even the same engine) - and it's incompatible with the main Unity physics. This is both a problem and also a feature: when computers were slower, it was nice to have faster physics for simple 2D games (alhough computers are so fast these days you can usually use full 3D physics for everything).

    However: if you are using other assets that are incompatible with Unity physics, and only work with 2D physics - or if you are writing scripts that only work with 2D physics - then we have a problem. I think I can add a 2D add-on to SnP that works with 2D physics too - but it means duplicating a lot of code, and doing a lot of testing to check it works. In theory it could be quick - only a couple of days - but in practice I can't guarantee a timeline for that. As noted above: so far everyone doing 2D has used the full Unity physics engine, so it's not been a problem before (but I would like to solve this if I can!)

    TL;DR: email support @ snapandplug.com and let's dig into this in more detail, and I'll see what I can do for you.