🌍 Get the Game Courses Bundle 3x1! game.courses/code-monkey-bundle/ (Includes Steam Keys for my games as a FREE bonus!) 📝 POLYGON Fantasy Pack assetstore.unity.com/packages/3d/environments/fantasy/polygon-fantasy-kingdom-low-poly-3d-art-by-synty-164532?aid=1101l96nj&pubref=housebuildsystem ✅ Get the Project files and Utilities at unitycodemonkey.com/video.php?v=Cdcn6uK9gPo
Hi Code Monkey, Me and a friend of mine are about to release a game in Steam. I just wanted to say thank you for this channel. If there's a way to DM, I just wanted you to know there's a free key waiting for you. You and many others like Brackeys, Gabriel, Jason or Matt are part of this. I dont want this to be an advertisement without your consent so no link by now.
Hi! I downloaded the project files but it looks like there is a ton of stuff there from different videos. Is there a project with just this system to check out? Is there a scene file with it all to see how it's working together?
hats off to Code Monkey for promoting or mentioning other fellow youtuber that he used ideas or they had done similar things like him. that's a good sportsman right there.
Can you please make a course or a video series that goes into everything you are doing step by step including animations? And details for a beginner like myself?
This video is absolutely great I have looked everywhere for a building system tutorial but this is by far the best I have come to your teaching style is absolutely fantastic
Dear Code Monkey I really appreciate what you do for us, I am learnt alot and still learning from your videos, You really dont know how thankful I am to have you.
actually not, his videos are summaries at 20x speed, and his live coding sessions show, that he is fast for 5 years of practice and typing with 10 fingers. navmesh-baking, or implementing a path-finder without navmesh-reqirement, actually takes a lot of time.
It's all about experience! After writing code for 20 years you start to remember that you already solved similar problems previously so the solution comes more easily!
Thanks for the vid! I was looking for an approach to make the grid system work along the Y axis, at first I thought of making a Grid class with all 3 vector coordinates but this looks simpler and less of a mess 😅
Love this -- I've been building something similar for a game I'm making, just for fun... I basically have a World Manager that splits everything into chunks, and these chunks are essentially based off your Grid System. I then load these chunks following the POV so I can have very large worlds at decent run speeds -- I had to do this because I use a grid layer for the terrain tiles, so on a 256x256 grid it quickly gets heavy on the GPU. It's somewhat inspired & mixed with the whole "Minecraft voxel chunks" concept but it really isn't the same thing since it's not really cubic. For multiple stacked objects, I just converted the List index to Vector3Int instead of Vector2Int, and keep track of the Y-layer with a hard limit of 8 layers. The only real change I have versus this is that I've added an extra grid layer for triggers, and created an RTS/FPS camera switch, so when a character enters a door, I switch to a first-person view inside the building. It's not quite the way I want it to be yet but that's the idea. 😅 In any case, thank you for your videos, they helped me get started and opened my eyes to the bigger picture. It's fascinating how once you get the hang of things, adding to just becomes fun. Gonna go grab that Patreon link now, you deserve it.
nice. i would also like to see you try at 07:35 and use that rendering effect to your rooftop instead of your player character. and make it able to go completely transparent (diablo Arpg style) or as you have it now but reverse for the rooftop.
Could you add a feature where, after saving an object, you can choose to paste it on grid or as a loose object so that you can rotate houses after building them?
Hmm interesting, yeah that could be done, just need to make LooseObjectTypes that mimic the Floor and EdgeObjects. Alternatively it would also be possible to use some math and some logic to rotate a ground 90º
Your videos are great, but can you go into more detail on the grid system. tried following your videos but there's edits between each video that makes it hard to follow along and learn instead of just downloading your code.
This system has been built piece by piece over 2 years so yea it requires a bit of work to understand how it all connects. Maybe one day I'll make a step-by-step course on making it all from scratch.
Awesome video. I'm very thankful that you showed me how a grid system is so powerful (I'm following all yours videos of grid system 2D and 3D). I just didn't liked the doors behavior. As you cited Brackeys, I recommend a video from SpeedTutor about doors kit system it is a very nice system available for free in the Unity assets store
do dual contouring with qef() solver. only makes sense as compute-shader, else it would be way too slow. the search function of the pouet-forum is a great start.
@@CodeMonkeyUnity This can be done very simply with a shader that visualy "cuts holes" into objects by making part of the object transparent. This shader can also be used to cut windows or door way into any solid wall. Of course you'll then need to cut an appropriate hole into the collision models.
I would really like to use this kind of powerful code as a world builder tool in editor mode. Could you show or tell us how bout's we would I get the new code added here & the code from the previous city building tutorial working and tracking mouse movements in editor mode? To be able to quickly move and track the mouse whilst placing objects in editor would be a massive boon to quickly building modular worlds quickly.
It would take a bit of work but yup you can make it functional in the editor I believe the method for raycasts is different, and spawning prefabs is also slightly different. Maybe a better approach would be to build it in run-time, then save it as JSON and in the editor load that JSON, might be easier
Loving the tutorials, I'm trying to do something just like this for a game I'm working on. Some quick questions: Do you know how you would go about showing the grid in play-mode? Is there a way to allow the grid to have negative grid points? I'd like to be able to change the grid size to without having to adjust the origin point, as that would also change the positions objects are loaded back into. Would it be better to have all the house building objects on one layer and use a RaycastAll to check for the building type of the object? or would this be overkill. Just to save a few layers for the future if needed.
You can show the grid with a custom tilemap like I built here unitycodemonkey.com/video.php?v=gD5EQyt7VPk And I used it for exactly that purpose in the Factory game unitycodemonkey.com/video.php?v=88cIVR4KI_Q Technically you could have negative grid points as long as you have space and some offset in the underlying array, but that sounds like really confusing logic. Instead I would just make multiple grids and stitch them together. Yup you can indeed do RaycastAll and test if the object has some script to identify it.
If you follow the rest of the Grid System playlist you should be able to understand it. Most of the videos on that playlist are step-by-step tutorials.
I thought this was a paid asset wow. I'll definitely give this a try. Just out of interest is there a way to make this building system conform to uneven ground. Like suppose I wanted to place a house on a hill. Would there be a way for the hill to flatten to the shape of the house?
Flattening the hill would depend on what terrain system you're using. I've never tried modifying the Unity terrain system at runtime so not sure exactly how that would be done Another alternative is making the floor fit the terrain, you can use the terrain normal to rotate the floor object, kind of like I used to rotate the Scout probe launcher unitycodemonkey.com/video.php?v=67WObFrWpRg
Hello, I'm a newbie so I don't quite understand everything you said here. I follow through with every single video you have on this list, it is so painful but feels rewarded in the end. anyway, do you have a cause that explains this system step by step? I mean sometimes your code in the video is not the same as in your provided project. in order to solve that sometimes I write my own code in it and most of the time it conflicts with yours so... I'm telling you that I'm happy to pay for it at any cost just to learn this building system.
Sorry I don't have a step by step course on this topic. This Grid System started as something pretty basic and over the years I added more and more things to it, I never planned right from the start to build all these systems on top so yeah there are a bunch of things that were done off screen although if you watch all the videos you should be able to understand the core logic behind it and understand the rest by browsing the project files.
Is there a way to handle the NPC not run into objects? Like using nav mesh? Do you convert all the objects to static and recalculate bake the nev mesh? Seems expensive any ideas?
When I try connecting my phone to unity remote 5 In editor project settings Computer doesnt find my phone. Everything is well connected and i installed unity remote 5.
Usually its good practice to separate the visuals from the main object, so your visuals are a child of the object that contains the logic. Then just go into that prefab and swap out the visual for something else. If you place everything in the same parent object then yes it becomes much more difficult
I didn't do it in a specific video, first time I used XZ was in the Grid Building System ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dulosHPl82A.html It's just a handful of changes so if you compare the projects files from that video with the 2D one you'll be able to see the difference.
@@CodeMonkeyUnity Ah that'd explain why I couldn't find it :) I saw the change in that mentioned video and was like "What did I miss?" haha. The underlying concept really should be the same regardless of what plane it uses anyway as long as it is still a 2d grid.
Hi. Got an error on the website saying "Failed to download file" (for the project files). (edit) I was able to get them on MS Edge. Also, thanks for the videos!
One way would be with a cutout shader so you look through the objects Or another way is just write some logic to identify objects above the player, maybe with a BoxCast, and hide/fade those objects.
Hello, great tutorial but I tried to load the package on Unity 2020.3.10 and I get an error Shader error in 'TextMeshPro/Mobile/Distance Field': Couldn't open include file 'TMPro_Properties.cginc'. at line 92. Any idea?
Also got this error. In case anyone else has the same issue here's one fix.. In GameScene > Hierarchy tab: Click GameHandler > UI > Canvas > GridLevelUI > Text Under Text > Inspector tab: Find Shader > Set to TextMeshPro/DistanceField
How would you go about creating some type of runtime LevelBuilder using this system? Turn them all into ScriptableObjects? Or do you have a different approach?
@@CodeMonkeyUnity I know, that is the issue because once you stop "playing" the game in Unity, you lose all data/progress. I want to save this data, so the created objects stay even after quitting "the game".
@@CodeMonkeyUnity gotcha, makes sense to me. Right now I have one grid that maintains all of the "set pieces " I might have to go through and see about separating that into a grid of grids that each maintain all the set pieces.
Thanks as always , if you remember you use "O" keycode for saving map in update event , So I have a question , why saving system just working in update event ? i try to make button for saving , but the saving is not working , the json file included as below (when i want to save map with button ) but if i press [ O ] button everything is fine : {"placedObjectSaveObjectArrayArray":[{"placedObjectSaveObjectArray":[]},{"placedObjectSaveObjectArray":[]},{"placedObjectSaveObjectArray":[]},{"placedObjectSaveObjectArray":[]}],"looseSaveObjectArray":[]}
Looks like you're not saving any object, add some Debug.Log during the save cycle to see which objects it's cycling through. Did you make your own custom SaveObject class? IF so make sure you add the attribute [System.Serializable]
@@CodeMonkeyUnity Thanks for reply , No i didn't make any save class , check below , thats your code , in update just [ O ] key for saving , am i right ? i am just making public void class and just put Save(); inside that for saving and link that to one button , when i press that button nothing happen just in debug show me i press button and in saving class everything is fine (look like) but nothing saving , but when i press [ O ] button saving system working, private void Update() { HandleGridSelect(); HandleTypeSelect(); HandleNormalObjectPlacement(); HandleEdgeObjectPlacement(); HandleLooseObjectPlacement(); HandleDirRotation(); HandleDemolish(); if (Input.GetMouseButtonDown(1)) { DeselectObjectType(); } if (Input.GetKeyDown(KeyCode.O)) { Debug.Log("data save"); Save(); } if (Input.GetKeyDown(KeyCode.P)) { Debug.Log("data load"); Load(); } } public void systemsavingTest(){ Debug.Log("Saving button Ok!"); Save(); }
This tutorial series is great and I've been following along, but I can't seem to figure out how to delete floorEdgeObjects or looseObjects at runtime. I may have just missed this somewhere but does anyone have an idea on how to implement this?
It's been a while since I made this system so I don't remember how I set it up exactly but for loose objects you can just do a Raycast, just like the mouse is doing, see if it hits a loose object and just delete it and remove it from the list. Same thing for a floor edge object, just need to update the parent to tell it the edge was deleted.
@@CodeMonkeyUnity yes but I want to see the lines in the actual game when the player enters building mode.Also thanks so much for responding that was fast you really care a lot about your viewers.
@@fodk7021 Oh for that you need some code that cycles through the grid and creates a mesh or some sprites for the visual. I did that in the Factory Sim game which also uses the game Grid System ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-88cIVR4KI_Q.html And I also covered how the overlay works in the Heatmap video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-mZzZXfySeFQ.html
Not sure what you mean, this video is a tutorial although it is based upon things that were built in other video tutorials, there's a Grid System playlist in the description unitycodemonkey.com/search.php?q=grid
I mean, it’s a demo of what was built. Would love to see when you code it like in all your other videos. For example the video where you make the grid building system with houses. It was excellent! It helps to see you talk about / write the actual code than just downloading it and trying to figure it out. There are a lot or differences from the grid building video right? Thank you so much for doing these videos!
Looking trough your excellent code I got it almost working. Problem is that when adding walls they do not "stick" / cannot find the edges :( Been struggling with this a week now. So so close. Do you know what the issue can be? Is it possible that you can provide a zip file with only the bare minimum? It is so hard with so much code, expecially since this video does not actual go step by step how to modify your previous code.
It's been a while since I made this video but if I remember the side walls are snapped to a collider on the edges, so just go through the code where it's doing a raycast to find the edges. I don't remember if I used a Layermask or not, perhaps you need the side edges on a different layer.
Hello i tried to open in this 2022 Universal RP and it doesn't seem to work, all i see in a capsule. Ill try to get the low poly assets by Synty, what are the controls?
Complete video? You mean the rest of the Grid System? It was covered in multiple videos, all on this playlist ru-vid.com/group/PLzDRvYVwl53uhO8yhqxcyjDImRjO9W722
And where is code it isn't in video and i don't know where to put it from project files be cause i have problems with materials and URP and lot of errors
@@CodeMonkeyUnity Using the latest version of Unity, starting a new project, importing the package (downloaded from your site) and then building triggers this and a mess of other errors. I tried to compile with your utility package added to no avail. Should I be including any other packages?
@@CodeMonkeyUnity My mistake. I forgot to read the prerequisite. I added your utility class to this package and the only issue I see is that on line 43 of WeaponTracer you're using UtilsClass.GetAngleFromVectorFloat3D(shootDir) instead of UtilsClass.GetAngleFromVectorFloatXZ(shootDir)
For added realism, could you have sloping land blocks? Add these to the base grid, to emulate a real world slope. Walls need to be custom height, to ensure floors are level. For anyone who wants to recreate Frank Wright's Falling Water house, or the Edinburgh Writer's Museum (Lady Stair's Close)
Sure you could make some foundation objects that get placed "inside" the terrain, then normal floors and walls and then just add more levels total and possibly some extra logic to limit how high you can build based on the height different to the terrain right underneath.
Help Me Please... Im trying to play with the code and learn but when i import some of the files to another project this fails in the SelectPlaceObjectsUI placedObjectTypeTransformDic[HouseBuildingSystemAssets.Instance.floor] = transform.Find("FloorBtn"); this is the error: NullReferenceException: Object reference not set to an instance of an object SelectPlaceObjectsUI.Awake () (at Assets/Script/HouseBuildingSystem/Scripts/SelectPlaceObjectsUI.cs:22)
You have something set to null, use Debug.Log to find out what unitycodemonkey.com/video.php?v=5irv30-bTJw In that line its either the dictionary that wasn't created, or the HouseBuildingSystemAssets.Instance is null