Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[RELEASED] uConstruct - Fully generic, socket based runtime construction system

Discussion in 'Assets and Asset Store' started by ElroyUnity, Oct 17, 2015.

  1. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    So wait maybe I didn't understand properly.
    What is/was the issue?
     
  2. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    The issue is if I don't set my player to Ignore Raycast layer instead of player then placement doesnt work right.
     
    ElroyUnity likes this.
  3. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585

    Uhmm weird,
    Let's try something, go to UCPhysics.cs and change line 74 to
    if (UnityEngine.Physics.Raycast(origin, direction, out rayHit, distance, mask))

    See if that works out?
     
    llJIMBOBll likes this.
  4. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    Fantastic, that did it! Thank you for helping out, that was driving me nuts.
     
    ElroyUnity likes this.
  5. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    No problem :) will submit as a fix :D
     
  6. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    Now that I got things rolling along a little bit more I came across another issue. When placing an item, if it's the last one left it doesn't get removed from the Inventory Pro equipment slot in the character window. At this point it is stuck until I reset things. If I have multiple building pieces it decrements fine, its just that last one.
     
    ElroyUnity likes this.
  7. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Interesting, will get an inventory pro setup running this weekend and get you a fix :)
     
  8. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    Awesome, that would be great. On another note, something for me to work on until that is resolved.

    I got my foundation setup with all the sockets and its working out. However, my foundation has height to it. More it is a platform similar to your example foundation with legs. I'm trying to set it up so that the legs can go under the terrain and you can adjust the height as long as legs do no go above the terrain or the main platform does not go below the terrain, if so it turns red as not placeable.

    Optimally it will be based on ray distance, if your at max distance and keep looking up the platform will raise. I tried messing with the offset at run time and changing the collider size trying to determine the best way to accomplish it. Is this something built in that I'm missing or will I need to code it in?
     
    ElroyUnity likes this.
  9. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Uhmm you can just use the CheckForTerrain condition under each leg :)
     
  10. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    That is only part of it which I got. I want the player to be able to raise/lower the foundation within the limits of the foundation height. Its up to them the starting point of the foundation height, could be flush with the terrain or up higher. You mentioned in the documentation "like Rust", that's exactly it.
     
    ElroyUnity likes this.
  11. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    You could make a key check for PageUp/PageDown or something like that and when pressed simply change the Y placingOffset of the structure :)
     
  12. MourningWood

    MourningWood

    Joined:
    Feb 20, 2017
    Posts:
    15
    Gotcha, thanks for the clarification, I was just making sure it wasn't built in first. I think instead I will base it on the raycast hit distance. Closer it gets to you it will become flush with the terrain, further away it will raise.
     
    ElroyUnity likes this.
  13. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Yep thats also something you can do :)
    Will let you know about the inventory pro fix in the upcoming days :)
     
  14. laurie71

    laurie71

    Joined:
    Aug 15, 2018
    Posts:
    37
    I never heard back about updating the free/demo version of uConstruct so today I pulled the trigger and bought the full version. Sadly, when I created a new, empty project and imported uConstruct into it I was met with pages of warnings and errors :-/

    Cleared the errors and opened the CubesDemo scene. Couldn't seem to to do anything but spin the camera around, but then I noticed lots of errors showing up in the console; I hadn't created the layers uConstruct needs and it doesn't do that for you. Created the layers, re-ran the scene but still couldn't do much. The documentation says the key controls are shown in the UI, but they're not; everything shows either "0" or "1".

    I figured out that hitting the 1 key turned on placement mode, but couldn't place anything -- the placement ghost was red and clicking anywhere had no effect. Finally figured out WSAD / arrow keys work to move around and managed to escape the maze of random objects I was trapped inside of, and was finally able to place a floor section. Figured out that some other number keys would sometimes enable placement of other types of object, to a limited degree.

    Next I imported Inventory Pro and tried out the integration demo. It was almost completely non-functional, and again the console was full of errors. Since a lot of them were about missing script references I tried re-importing uConstruct (on the theory that the script references that were missing may have been due to not having Inventory Pro in the project. Unfortunately, that didn't fix anything.

    [EDIT]: I also tried building and running the CubesDemo scene on an iPad. The first line of the asset description is "*MOBILE READY*", which is the main reason I've been gravitating towards this solution. I had low hopes by this point so I wasn't surprised that it wasn't usable. I haven't dug in to see if the demo scene actually contains anything mobile / touch-input related, but even if the product is 'mobile ready' the demo certainly isn't.

    All in all everything feels clunky, unpolished and broken. I should have waited for the free/demo version and saved myself the $30 :-/

    Unity 2018.2.7f1
     
    Last edited: Oct 12, 2018
    ElroyUnity likes this.
  15. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Hey,
    DId you follow the documentation? Did you create the layers?

    Please mail me or add me on skype - elroi145.

    I will go through the issues with you until everything is fixed and working as you would expect it to :)

    Elroy
     
  16. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    214
    Hi, I just bought uConstruct and I can already get it running. I now need to add the building when I use the item,and press right mouse to cancel build,what api I should use in my item use script?
     
    ElroyUnity likes this.
  17. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,629

    I use this since it was in beta for mobile ( Just sold the game to an investor. ) it worked flawlessly. I made some of my own changes, due to the nature of my game. and what I was using it for. but as far as mobile. not sure what was clunky sorry I dislike that word as it don't explain the issue. I'm sure Elroy will help you get it going if there is an issue. but I never ran into anything game breaking.. I also do not use unstable versions of Unity or beta versions, so I can't comment. 2017.4 is Unity most current stable version. 2018 is getting there, so it should work fine. but can't say with out errors as I know Unity 2018, has a ton of GUI issues and editor related issues, that they been fixing. :) Anyways i'm sure Elroy will help you. regardless. good luck with your game. on Mobile.:)
     
    ElroyUnity likes this.
  18. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Uhmm what do you mean? Are u using an inventory system?

    Cheers :)
     
  19. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    214
    I used my own inventory, now no problem, I found the way, just call the properties and methods in the placer script.
    Thanks for reply.
     
    ElroyUnity likes this.
  20. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Happy you worked it out :)
     
  21. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    576
    Nice Find! Now the sea don't interrupt placing foundations :D
     
    ElroyUnity likes this.
  22. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    :)
     
  23. hacker3220

    hacker3220

    Joined:
    Sep 2, 2013
    Posts:
    3
    Hey, any chance this may get integrated for UFPS2?
     
    ElroyUnity likes this.
  24. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Hey, not any time soon :( sorry
     
  25. ChillyMcChill

    ChillyMcChill

    Joined:
    Nov 17, 2016
    Posts:
    57
    Has anyone got this to work with VR? Or VRTK? How can I integrate it? IANAP :(
     
    ElroyUnity likes this.
  26. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Shouldn't be a problem :)
    What are the issues you are facing?
     
  27. ChillyMcChill

    ChillyMcChill

    Joined:
    Nov 17, 2016
    Posts:
    57
    Is there a tutorial for setting it up with VR? I am not a programmer :(

    I would like to map placement buttons to the touch controllers
     
    Last edited: Dec 30, 2018
    ElroyUnity likes this.
  28. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    No, I will try to make a demo for you but I don't have time week.
    If you do end up trying and need help feel free to ask, but I will try to get you that demo anyways :)
     
    ChillyMcChill likes this.
  29. ChillyMcChill

    ChillyMcChill

    Joined:
    Nov 17, 2016
    Posts:
    57
    I'll wait on the demo! Thank you so much I really appreciate that :)
     
    ElroyUnity likes this.
  30. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    My pleasure :)
     
  31. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    About VR, I was abIe to make uConstruct work with Vive pretty nicely, except I cannot find a way to draw all the buildings prototype lines (e.g. sockets in VR). Could you please help what should make the trick? If I set Camera.TargetEye to None, it displays everything OK in preview window, but as soon as I choose anything else it just skips drawing those lines.
     
    ElroyUnity likes this.
  32. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Uhmmm that’s a good question, you are talking about Gizmos or the preview material when placing the building?
     
  33. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Yes, about gizmos (I think, more like guiding lines for me), it seems Graphics.DrawMesh (if I remember correctly looking at your code, not a t home now) doesn't work in VR. I I changed your code a bit to always show a building part when moving it, so it is easier to set up, but visual guidance where to put that part would be more convenient anyway.
    And a big thank you for your continuous support, I bought it several years ago but haven't chance to really try it, and it is so easy to work with.
     
    ElroyUnity likes this.
  34. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    First of all, absolutely, happy to help :)

    Regarding the issue - uhmmm do you want to send me a picture of what you mean? still can't really understand what you are talking about, sorry!
     
  35. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    I sent PM with pictures to you, thank you for looking into this!
     
    ElroyUnity likes this.
  36. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Hey, In the Photon Cloud demo integration if i spam left click i'm able to place multiple foundations in the same location, and after that the whole system kinda breaks because i'm now able to keep placing multiple things all on top of eachother:


    Edit: I was able to kinda fix this by expanding the box collider size to 5.99/6 units for the CheckForCollisionCondition, now it behaves like this:


    that makes these lag spikes appear though:


    Also, i can't uncheck this checkbox, it keeps rechecking itself every time i press Play in the scene:


    Pretty good asset otherwise!
     
    Last edited: Jan 13, 2019
    ElroyUnity likes this.
  37. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Hey!
    1. Interesting, will have a look in the next few days (in the army now so I am not near the office)
    2. Oh makes sense, go to the "PhotonCloudBuildingPlacer.cs" file and remove line 20 (PhotonCloudBuildingPlacer)
     
  38. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Also, I'm having problems with a rotated building part.
    I want to be able to free place props on it, so i made a freeplace socket (The one that has 'Default draw socket' enabled)
    But the free socket somehow seems to get expanded into a cube of some sorts and I'm able to place the object all around it
    If i rotate the same part to 0,0,0 it seems to work properly


    Edit: Fixed it by disabling uConstructPhysics on that socket and replacing with a standard box trigger so unity physx can take over the raycast
     
    Last edited: Jan 14, 2019
    ElroyUnity likes this.
  39. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Awesome :) happy you fixed it!
     
  40. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Another problem, if i change the building's health in the Photon Cloud Integration from 100 to even 99, it just destroys itself immediately
     
    ElroyUnity likes this.
  41. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Really? I haven't actually encountered that before.
    Can you show me the code where you change it?
     
  42. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Hmm, the problem seems to be with my modification to the BaseBuilding editor class to just expose Health as an editable parameter
    script.health = EditorGUILayout.IntField(new GUIContent("Health", ""), script.health); , probably tripping off some getters/setters or something
    When i use the editor debug mode and change health there, it doesnt call the setter, also not calling OnHealthChangedEvent, so the wall doesnt get destroyed, but if i change it through the editor variable that i just exposed, it does trigger a setter and does call the function.


    Also, if you dont mind me asking, why not use the Photon's RPC's instead of custom messages?
     
    ElroyUnity likes this.
  43. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Uhmm that's strange, you should only change the max health, not health.
    And I use custom messages to fully control the way it transmits the buildings especially for new connections :)
     
  44. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    What do you mean?
     
    ElroyUnity likes this.
  45. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Code (CSharp):
    1. building.AssingNetworkedHealth(data.health);
    It seems that this method gets called twice when i change the health variable, first time with proper health value, second time health value is always 0 and that destroys the object
     
    ElroyUnity likes this.
  46. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Yep, but instead, change the building.MaxHealth, not the health variable.
     
  47. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    So is BaseBuilding.health an internal thing? If i wanted to made like a breaking and repairing buildings mechanic, would i use building.health, building.maxHealth, or make my own variable?
     
    ElroyUnity likes this.
  48. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    You would simply do -
    building.Health -= value;
    To assign initial building value - building.maxHealth = value
     
  49. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Yes, doing that immediatly destroys the building for me in the Photon Cloud integration
     
    ElroyUnity likes this.
  50. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,585
    Uhmm I see, will have a look today and let you know:)
     
unityunity