🌐 Have you found the videos Helpful and Valuable? ❤️ Get my Courses unitycodemonkey.com/courses or Support on Patreon www.patreon.com/unitycodemonkey
@ssj3mohan4 жыл бұрын
And how to make it as3D project ?
@CodeMonkeyUnity4 жыл бұрын
@@ssj3mohan You need to do a raycast to get the mouse world position in 3D then replace the physics checks with the 3D versions and place it as normal
@ssj3mohan4 жыл бұрын
@@CodeMonkeyUnity Thank you so much i will try it .
@popescualex51054 жыл бұрын
Hujjjjhhnbhhj8ubvvvvvvvvv p
@hemanthrj964 жыл бұрын
Your content is still so underrated. Your tutorials are the best tbh. Also I'm actually really looking forward to any kind of multiplayer tutorial series you may or may not be planning. Pretty sure it'd turn out really well and helpful.
@CodeMonkeyUnity4 жыл бұрын
I've been waiting for Unity to release the new DOTS Multiplayer tools but still no idea when that might happen. When it does I definitely want to to a bunch of tutorials on it.
@hemanthrj964 жыл бұрын
@@CodeMonkeyUnity That'd be great even though I was hoping for mirror or photon but DOTS will also do I guess😄
@ImFrantic3 жыл бұрын
I looked through YT for a good turtorial and you isntantly had me as you created an Empty GameObject as the building manager. I don't know why but organizing things in Unity get's me harder than The Rock fighting with a rock so thanks alot Sir.
@kevinreich80324 жыл бұрын
I bought the course and it's the best course for Unity ever :)
@CodeMonkeyUnity4 жыл бұрын
Thanks! I'm glad you're enjoying it!
@trevorsb3 жыл бұрын
Favorite coding youtuber! Very helpful and I learn way more then other channels!
@CodeMonkeyUnity3 жыл бұрын
Thanks! I'm glad to hear you've learned a lot!
@ImFrantic2 жыл бұрын
Hey, so I had to do this for my 3D game and had to work with ray cast for that. I now found out how to detect the collider for 3D games. So as promised here it is: if (Physics.OverlapBox(position, buildingBoxCollider.size / 2, Quaternion.identity, layer_mask) != null) { return false; } else { return true; } The "layer_mask" is a variable which I created as an int simply to store the number of the layer I want to ignore. In my project that's the ground(Unity terrain). So as you can see it's not too different but got me hanging there for a couple of minutes :D
@aceproductions38832 жыл бұрын
why it doesnt work for me ? , i didnt follow the video of creating scriptable object etc.. i just made 1 script that detects where the mouse is and instantiating a tower prefab on that point and i made a bool exactly like yours, that takes the prefab transform and the mouse position and still nothing spawns...
@ericf.22674 жыл бұрын
Would also love to see a tutorial on grid based building placement to complement this one (and would also complement your grid system tutorials!)
@ItzTime2FIy4 жыл бұрын
Not sure about his grid system, but to snap the buildings to a grid you would just round the x and z values of the final position.
@oatcube39614 жыл бұрын
@@ItzTime2FIy This is how I did it. I also made the "Can not build" bool function to check only if the coordinates change. As to not refresh the function in update on every frame.
@ItzTime2FIy4 жыл бұрын
@@oatcube3961 if your checking for the coordinates changing then you are still updating every frame to see if they change though?
@oatcube39614 жыл бұрын
@@ItzTime2FIy Yes, but it's better performance wise to only check for the coordinate change. I'm refreshing the buildings color whenever it moves. Also a few of my buildings have an effective radius that affect the buildings around them.
@sahilsharma28674 жыл бұрын
As always nice video Keep up the good work!!
@DanielAbeleira4 жыл бұрын
This is actually very useful. Thanks
@jean-michel.houbre4 жыл бұрын
Clear and interesting, as usual! Thank you.
@oatcube39614 жыл бұрын
I just created a system like this for a grid based game. It's nice to have that I have much of the same applications as you. I didn't use scriptable objects though. I have a "master" script that I attach to every building, then I have building specific scripts that define stuff that a specific building does. Then I have those gameobjects as prefabs that I spawn. I also have only 1 prefab per building so through the construction phase the building is the same gameobject. I had a few problems at first on how to work around a save system etc. But a few boolean checks on if the building is ready or not fixed it. This vid game me nice insight into the animations I will have on the buildings. Also I have an array of buildings in a BuildingManager class that manages things like total amount of buildings, building costs, tooltip information, building names etc. So when choosing a building I'm referring to and index of array to check for everything. It just seems easier to refer to a "house" as 1, and then have resourceCost[1], buildingPrefab[1] etc. I'm still trying to implement scriptable objects into my workflow, but it just seems easier to do everything with arrays and indexes.
@galrose71654 жыл бұрын
Thank you for the inline curly brackets on 8.. Crazy how some people can withstand any other way :D
@tonkodonis96182 жыл бұрын
Super useful ! Thanks
@ogamefan224 жыл бұрын
I think some poeple perhaps thinks as I do when I ask if you have any patreon link so we can donate as a way of thank you all the knowledge and time you spent on these videos for us.
@CodeMonkeyUnity4 жыл бұрын
Yup, there's a Patreon link in the description, it's a huge help!
@libradohernandez65254 жыл бұрын
This is so cool! Thank you!
@CodeMonkeyUnity4 жыл бұрын
💬 Freeform Building System! This is a really awesome system because it does not require an underlying grid, just click and place. Check out the full course to see this system in more detail as part of a complete game! 🌐 unitycodemonkey.com/coursebuilderdefender.php
@tauheedgamedev23884 жыл бұрын
Great Tutorial but I already have your Builder/Defender Udemy course, Great work on that by the way. 👍
@farvardinmainyu19614 жыл бұрын
It's awesome! Thank you Code Monkey!
@cristiancristea31684 жыл бұрын
Just got the course on udemy, good one. A video/course about 3d city building games would be great.
@CodeMonkeyUnity4 жыл бұрын
Thanks! Hope you like the course!
@dspartan0074 жыл бұрын
great video as always friend
@christianbrandon23504 жыл бұрын
Wow, really cool!!
@rc0d34 жыл бұрын
I love to see it!
@SuspenseGames3 жыл бұрын
I was really hoping you would cover how to make the currently selected building “hover” at the mouse while selected. Using a green highlight for when the placement is positive (an update check on the bool you used could work depending on how intense that check is) and red when it’s over an invalid area.
@CodeMonkeyUnity3 жыл бұрын
I implemented a Ghost in my Grid Building System kzbin.info/www/bejne/mqbPoKZ-hdFraKM It's essentially another Game Object that always follows the mouse and you change the mesh depending on the object type selected
@thegreatemu21372 жыл бұрын
great tutorial, question: how do we use this with photon for multiplayer? i tried to use it with photon but it doesn't sync properly for other player like they can't see my building being placed and i can't see their.
@hiozero4 жыл бұрын
Feel like an idiot for buying the course on Udemy now you are putting up the videos for free!!
@CodeMonkeyUnity4 жыл бұрын
The whole point of the course is to learn how to make a complete game from scratch. If all you wanted was a Building System and nothing else then there's plenty of tutorials available. I covered several differences between Tutorials and Courses here kzbin.info/www/bejne/hpSko51_eJaEpLM Weren't you interested in learning how to make a complete game from start to finish?
@arcday42814 жыл бұрын
This only encourages us to buy this course. The video shows how interesting and useful the course is. We NEED to do a couple more courses to cover different genres. For example, a "2D platformer" with various systems: skill tree, inventory, etc., well, this is my personal preference )))
@hiozero4 жыл бұрын
@@CodeMonkeyUnity okay. I thought you were going to put up all 10 hours of video
@damdakos4 жыл бұрын
I know how you feel but there are so many tutorials out there you can use. It costs a lot of time sometimes to look for what you really need. But to be honest, the course is sold at a reasonable price. If you check other content creator courses they sell at a much higher price. I really appreciate the content and even this video is uploaded I will purchase your course to support you when I have time to go back to unity to make a game. I think Code Monkey covers a lot of mechanics and advanced aspects for free. So, in your case you should not feel like an idiot, rather think that you supported the creater that you felt it was worth for you and you showed your appreciation. At the end, if you feel the course was beneficial to you, be happy.
@arcday42814 жыл бұрын
@@damdakos This is exactly what I think and many subscribers think. Even if the course is not needed, buying a course we support "CM" for his really great work.
@deeptiyadav9234 жыл бұрын
I needed it
@seesamuel63654 жыл бұрын
Nice!👍💪
@seesamuel63654 жыл бұрын
Thanks ❤️💕
@stoopochky3 жыл бұрын
[SOLVED] 10:35 i did exactly the same as you did, but for me when i click on buttons, it does not change what building will be placed. Any idea how to fix it? I checked, i did everything EXACTLY the same and in the same order, with the exception being that the buttons are going 60 units down, not right
@stoopochky3 жыл бұрын
Nevermind, i fixed it: i just chose the BuildingManager prefab, not the one in the scene so for some reason the one in the scene did not update
@tonkodonis96182 жыл бұрын
My only issue is that my buildings are not square so I would like to use PolygonCollider2D instead of the BoxCollider2D, but gets tricky with the Physics2D Overlap... can't figure out how to make it work with the polygon collider...
@ekonkargames4 жыл бұрын
Nice tutorial.Can you make grid based building system with extended build area?
@CodeMonkeyUnity4 жыл бұрын
By extended building area do you mean start off with a small area and then expand? I made that in Battle Royale Tycoon by starting off with the full final grid and having each grid position store a boolean for isBuildable and then through a Research mechanic I just flip those booleans to true.
@ManasJoshi3 жыл бұрын
Great video!! I had a question. I want the cursor to not go through the building but stay on the boundaries of the building. Is this possible??
@CodeMonkeyUnity3 жыл бұрын
You need to find the object under the mouse, then do some math to find the closest valid point (object.position.x + object.size.x) and then use that point to place the ghost/building instead of the mouse position.
@Mik3Ehrmantraut4 жыл бұрын
Beautiful tutorial CM how about solving performance issues tutorial and tips how to avoid them or tips to make clean code tutorial, But anyway thanks for the hard work well done
@457Deniz4574 жыл бұрын
Thanks ! :)
@aryamotaghare84414 жыл бұрын
Can you show how to make different modes in game?Like multiplayer,tour or world cup,etc.
@CodeMonkeyUnity4 жыл бұрын
That depends on what game you're making, theres thousands of ways to implement multiple game modes
@aryamotaghare84414 жыл бұрын
Okk
@aryamotaghare84414 жыл бұрын
@@CodeMonkeyUnity can you then show how to make modes in the game. Any mode or example
@jaaaaaaaaaaaaaay3 жыл бұрын
Thanks
@damdakos4 жыл бұрын
Hey, very nice tutorial. Thank you very much. Are you planning to create a course on how to build "blueprint tycoon" style game?
@CodeMonkeyUnity4 жыл бұрын
You mean a build system on a grid? Yeah I'd like to cover that at least in a tutorial
@damdakos4 жыл бұрын
@@CodeMonkeyUnity Yes. Are you also planning to cover the production aspects? I also thought a Udemy course where you show how to create a similiar game as your blueprint tycoon game.
@bluegru4 жыл бұрын
Is there a difference in using Transform instead of GameObject in the Inspector to drag prefabs (or objects from the scene) in? I usually use GameObject
@CodeMonkeyUnity4 жыл бұрын
They are mostly interchangeable since every Transform is attached to a Game Object and every Game Object has a Transform.
@gamesunity76794 жыл бұрын
Could you make a course on rim world building?
@CodeMonkeyUnity4 жыл бұрын
You mean a build system on a grid? Yeah I'd like to cover that at least in a tutorial
@termisher56762 жыл бұрын
how to do it when camera is in angle of 45 degree in 2.5d game?
@eliasgeorgiou51822 жыл бұрын
What is the difference between Checkbox and OverlapBox ?
@CodeMonkeyUnity2 жыл бұрын
CheckBox just returns a bool, it doesn't tell you which colliders are overlapping. Perhaps that is enough for whatever you're trying to do.
@eliasgeorgiou51822 жыл бұрын
@@CodeMonkeyUnity So the checkbox is also better performance wise if we don't care about the colliders? Thank you in advance man.
@Shonnyy3 жыл бұрын
In this example, why would you make these building types into scriptable objects? If your scriptable object is only storing a reference to a prefab and then your building manager is being assigned a building type from the inspector and reaching through it to access the prefab, why not just directly pass the prefab via the inspector to the building manager? Have I misunderstood something here cus I don't understand why this example proves scriptable objects are "good"?
@Shonnyy3 жыл бұрын
Ahh mmk, he later went on to add more into the scriptable object. False alarm, imagine waiting till the end of the video to ask questions amirite
@CodeMonkeyUnity3 жыл бұрын
Yes the main reason is you can add more data to it. If you absolutely just need a transform then yes having a direct transform reference will work just as well
@kootsy24653 жыл бұрын
How do I make it so that there are multiple rows of buildings that you can place? currently if you add a new building it stays in the same row as the other ones. Also is there a way that I make it so that you have to buy the buildings?
@admink86622 жыл бұрын
Nice
@a.technology14464 жыл бұрын
Thank u
@EgeSayn3 жыл бұрын
Hello! Do you think it is reasonable to use this method in 3D?
@CodeMonkeyUnity3 жыл бұрын
Sure, just swap the physics logic for 3D I made a Grid Building System here kzbin.info/www/bejne/mqbPoKZ-hdFraKM You could easily replace the grid logic for freeform logic
@EgeSayn3 жыл бұрын
@@CodeMonkeyUnity Thank you!
@arcday42814 жыл бұрын
A steep course, no doubt !
@gamer_forgames97254 жыл бұрын
hello i downloaded your key and door system that you made, but when i put the player file to the main camera, aim did not shoot exactly where I was looking, how can I fix it?
@CodeMonkeyUnity4 жыл бұрын
What? The Key Door System has nothing to do with shooting
@gamer_forgames97254 жыл бұрын
@@CodeMonkeyUnity I have my own character and if I put my main camera my aim not correctly shoting he downs
@MrBwoskiАй бұрын
I doubt I will get a response on a 4 year old video, but I am having a LOT of issues with using my own code instead of the utilities. I will probably soon just give up and download them, but it will help if I can figure out how to code it. Thanks.
@CodeMonkeyUnityАй бұрын
What issues? There's nothing special in my own utilities. If you want you can download them just to inspect the source code and rewrite them in your own style
@Rocarth4 жыл бұрын
i cant seem to get this code to work and i don't know why, if you could tell me which parts of the codes are variables maybe that would help as this is my first unity code so this video is a bit difficult to read and understand
@CodeMonkeyUnity4 жыл бұрын
If you're a complete beginner then this video is too advanced, start off with these videos kzbin.info/www/bejne/f3fEqoSfpKxqZ6M kzbin.info/www/bejne/e2ekZYqsqKmYgqc Or pick up the course for a more detailed long form tutorial
@Rocarth4 жыл бұрын
@@CodeMonkeyUnity ty i appreciate it
@danielbasti37133 жыл бұрын
I am getting error, ArgumentNullException, but I just cant find why. Like I am not trying to set NULL as value... If someoen has the script, which I could just copy and paste, that would be helpful.
@CodeMonkeyUnity3 жыл бұрын
Where are you getting that? Use Debug.Log to find what parameter are you using as null kzbin.info/www/bejne/a5rVp2ZmYseHgNk
@mrdog-yx9oi3 жыл бұрын
yo At 13 56 everything is like it should be except the buildings dont spawn at all and i have already double checked code its the same not sure why, its something to do with the ispointerovergamobject but idk what(Also how does that make sense if the mouse is not over a gameobject for example if i am trying to build on grass it will be a gamobject therefore i wont be able to build on it????
@CodeMonkeyUnity3 жыл бұрын
That code should only be detecting UI game objects. Unless you added a Physics 2D Raycaster. Or you have an invisible window all over your UI
@mrdog-yx9oi3 жыл бұрын
@@CodeMonkeyUnity Is there a way To Make it detct object with a tag?
@eelstorm5254 жыл бұрын
Hey I'm super new to Unity how come my Inspect tool isn't popping up?
@CodeMonkeyUnity4 жыл бұрын
You mean the Inspector Window? Maybe you accidentally moved it, go to the top right corner where it says "Layout" and reload the Default layout
@eelstorm5254 жыл бұрын
@@CodeMonkeyUnity Yeah sorry that was one of my first times using Unity how come I get a error of "the type or namespace LIGHT2D could not be found" on character controller video?
@swdkalsa69163 жыл бұрын
Why function called GetMouseWorldPosition returnes an error ? :( NullReference I think somebody please help me
@CodeMonkeyUnity3 жыл бұрын
Use Debug.Log to find what is null kzbin.info/www/bejne/a5rVp2ZmYseHgNk
@swdkalsa69163 жыл бұрын
@@CodeMonkeyUnity Thanks! I find it out my camera was untagged.
@diggerfdf4 жыл бұрын
Love your content and the dynamic way you teach. But I have one point to criticize. You need to watch your pace. Not all videos would benefit for a "learn how to make GTA in less then 10 seconds". I like to follow the lessons. If you go in a too fast pace like "click, here, this is the game object click there, use the shader X with particle system Y, open Visual Studio, this is the code, click here, go there and we're done". There is no time to assimilate the commands, no time to look to where to click. I use the MacBook screen to play the tutorial. I know that you can go back and forth, pause the video etc. But it's extremely tiresome and annoying to repeat 5 times the same 10 seconds. Awesome content and I'm grateful for it. Just always remember to not lecture for those "whom already know the subject"
@CodeMonkeyUnity4 жыл бұрын
Sure I understand that but if I make every video over 1 hour long then no one will watch it. Based on how the algorithm works I have to depend on the viewer using the tools at their disposal to match their learning speed. On the course I can take my time and slowly build things. This whole system is built slowly in detail in the course over around 5 lectures rather than just one video.
@simontriulzi39164 жыл бұрын
I can't drag anything in the scriptable object field
@simontriulzi39164 жыл бұрын
never mind i got it
@shashikalashashikala69834 жыл бұрын
Make a c# course in vs code because my pc cannot run visual studio please make tutorial
@CodeMonkeyUnity4 жыл бұрын
The code is the same regardless of what IDE you use, watch this video for some quick C# basics kzbin.info/www/bejne/f3fEqoSfpKxqZ6M
@shashikalashashikala69834 жыл бұрын
@@CodeMonkeyUnity ok
@mustafaagha88344 жыл бұрын
How different working on ur project but in 3d environment.
@CodeMonkeyUnity4 жыл бұрын
Its very similar, just use 3D meshes instead of sprites and do a Raycast to get the mouse world position
@freedoomer25244 жыл бұрын
Could this system be used in 3D?
@CodeMonkeyUnity4 жыл бұрын
Sure, just need to change the way you get the mouse world position with a raycast instead and use Meshes for the buildings
@freedoomer25244 жыл бұрын
@@CodeMonkeyUnity sweet!
@keemybrzee84424 жыл бұрын
Will this work if im makeing a 3d game?Im haveing trouble doing that
@CodeMonkeyUnity4 жыл бұрын
Sure, the only thing you need to change is how you get the mouse position by doing a raycast.
@kobimcleod51083 жыл бұрын
@@CodeMonkeyUnity How would you go about doing that?
@JensKrumsieck2 жыл бұрын
@@kobimcleod5108 var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out var hit, 1000f, 1
@jasithiss3 жыл бұрын
how do u do this for mobile?
@CodeMonkeyUnity3 жыл бұрын
It's the same thing, just change the Input for Touch
@termisher56762 жыл бұрын
how to use utils?
@CodeMonkeyUnity2 жыл бұрын
All the code is included so just browse through it and look at the various functions and classes, then use them like any other class.
@termisher56762 жыл бұрын
@@CodeMonkeyUnity i am trying to make sunbath symulator but i ended up with 2.5 d beacuse sprites were cliping in uncontroled way and i dont like using something i don't understand from internet.
@switchstatement5684 жыл бұрын
In order to spend on udemy I need to earn from unity first
@holdingpointaviation4 жыл бұрын
Hey man, I’m making a 2d town maker, HELP PLEASE
@Sandflowgames4 жыл бұрын
THIS SUCKS IT DOES NOT WORK YOU CANT GET THE BUILDINGTYPESSO FROM THE SCRIPT VERY UNHELPFUL
@CodeMonkeyUnity4 жыл бұрын
What? What issue do you have?
@Sandflowgames4 жыл бұрын
@@CodeMonkeyUnity i could not get the change system working and i cant do the indeth tutorial because i dont have enough money because of bills