Master Grid Placement in Unity 2022 P1 - Calculating Cell Position

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 308

  • @SunnyValleyStudio
    @SunnyValleyStudio  ปีที่แล้ว +5

    Part 2 about grid visualization -> th-cam.com/video/nKF4Pwb-6Ow/w-d-xo.html

  • @rongreen385
    @rongreen385 ปีที่แล้ว +12

    I wasn't having much luck finding good examples of using Unity's Grid class and along comes your tutorial - yay! Thank you so much.

  • @JB_101
    @JB_101 4 หลายเดือนก่อน +3

    I love your passion for what the majority see as impossibly dull! I code for a living and for a hobby! Just trying to learn Unity now! 🙂

  • @IgnacioEsteves
    @IgnacioEsteves หลายเดือนก่อน +1

    This might be, hands down, the best tutorial I've ever seen in my life. Not even joking, you have too much talent!

  • @XconeArtist
    @XconeArtist 16 วันที่ผ่านมา +1

    You got great pacing. Enough details for me to learn, but not too much detail to get bored. I enjoyed watching this. Thanks 👍

    • @SunnyValleyStudio
      @SunnyValleyStudio  14 วันที่ผ่านมา

      I'm glad that you like it and I really appreciate your comment 🙂

  • @flatcoaster
    @flatcoaster ปีที่แล้ว +5

    I've never thought to use the Unity Grid component all this long... seems very useful now

  • @de_w0r
    @de_w0r ปีที่แล้ว

    Thank you! I'm not a native british or american, but i understood all frazes or words. My english level not low, and not high.
    The most best part of your tutorial is code. U make code so easy that hard to didn't undrestand what happen in video.
    One more - Thank you! +rep

  • @ianfavreau9776
    @ianfavreau9776 9 หลายเดือนก่อน +2

    To anyone having trouble with the Mouse Indicator Testing part, make sure you have a mesh collider on the plane you are using as your grid.
    Also, to anyone having trouble with the Cursor Indicator not aligning with the cursor, make sure it has the correct Y position as it is different in the game than in the scene viewport. Spend time to make sure it is perfectly level in the game when you hit play (it doesn't matter if it is below the plane in the scene mode).

  • @frmlsshrmn
    @frmlsshrmn ปีที่แล้ว +6

    This is extremely useful. I've been trying to get started on a base-building game and what I want to accomplish first is to make it possible to plop down objects (buildings) of various dimensions (1x1, 2x3) on a grid. So I'm looking forward to the rest of the series. Thanks!

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Awesome! I will be posting the remining parts this week.

    • @MuhammadBilal-cs3dg
      @MuhammadBilal-cs3dg ปีที่แล้ว

      @@SunnyValleyStudio can you please share the starter project link

  • @GocoYT
    @GocoYT 10 วันที่ผ่านมา +1

    Great straight forward tutorial! Love the stuff! :)

    • @SunnyValleyStudio
      @SunnyValleyStudio  8 วันที่ผ่านมา

      Awesome! Thanks for the comment 😍

  • @scjohnson243
    @scjohnson243 ปีที่แล้ว +2

    Really useful, been trying to follow one of these and have not had much luck, so far this one is great!

  • @wasifalmeem4651
    @wasifalmeem4651 ปีที่แล้ว +2

    Thanks a lot, really simple and straight forward. used prebuild unity components with a really simple logic. Thanks a lot brother

  • @opponentbacon
    @opponentbacon 6 หลายเดือนก่อน +1

    SUCH an amazing set of tutorials and like other people have also said; exactly what i was looking for. thank you so much !

  • @BlueDuck-vv3eu
    @BlueDuck-vv3eu หลายเดือนก่อน +1

    Thanks! I like this to the point style of teaching that you do.

  • @zeggxr1539
    @zeggxr1539 ปีที่แล้ว +2

    really excited to watch it, thanks for the great tutorials!!

  • @This-Was-Sparta
    @This-Was-Sparta ปีที่แล้ว +4

    Great stuff as always. Exactly what I was looking for.

  • @FrogKin9
    @FrogKin9 ปีที่แล้ว +1

    Thank you - again...
    Great work and alyways exactly what I'm looking for.
    As soon as I (or if I ever) earn some money with my Games, I will support you financially as well.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Thanks. And be sure to focused on making games first 👍 Making money from games is kind of separate skill and I don't think it is easy to learn it and make games at the same time 🙂

  • @hbcck
    @hbcck ปีที่แล้ว +1

    A very clear and entertaining video.

  • @Chigamungus
    @Chigamungus 9 หลายเดือนก่อน +1

    Fantastic tutorial! Exactly the kinds of things I was hoping to learn

  • @Berndr
    @Berndr ปีที่แล้ว +1

    Really great and clear strait forward explanation!

  • @jessepaulsen973
    @jessepaulsen973 ปีที่แล้ว +1

    Great vid. By the way this creator also has courses on Udemy. Several of the courses are great for people who have got the fundamentals of Unity and coding under their belt and need to start learning architecture, design patterns and internal testing.

  • @clintonhamil9371
    @clintonhamil9371 10 หลายเดือนก่อน +1

    Thanks! Using this in a Game Jam build right now :D

    • @SunnyValleyStudio
      @SunnyValleyStudio  10 หลายเดือนก่อน

      Awesome! Let me know how it went! 🙂

  • @КириллКурлянов-ф2й
    @КириллКурлянов-ф2й ปีที่แล้ว +1

    Thank's man. That just what I've been looking for

  • @yuhochih
    @yuhochih 10 หลายเดือนก่อน +1

    Thank you for making this tutorial, it is really helpful to me

  • @bane9109
    @bane9109 ปีที่แล้ว +1

    Hey Peter, thanks for this tutorial! Grid system is something i’ve had trouble with in the past, so I’m looking forward to learning how to implement this

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      I hope that my tutorial will help 🙂

    • @MuhammadBilal-cs3dg
      @MuhammadBilal-cs3dg ปีที่แล้ว

      @@SunnyValleyStudio can you please share the starter project link

  • @Lazzarus7
    @Lazzarus7 5 หลายเดือนก่อน +1

    Nice tutorial, very well explained!

  • @RavenG102
    @RavenG102 ปีที่แล้ว +1

    its a good start for my ideas, thanks!

  • @mezainab848
    @mezainab848 ปีที่แล้ว +1

    amazing and easy tutorials

  • @gabrielzanoni9961
    @gabrielzanoni9961 ปีที่แล้ว +1

    Thank you very much! You teaching skills are awesome!

  • @jaybehl7567
    @jaybehl7567 ปีที่แล้ว +3

    Hi, when I import the project assets (i only import the ones needed for the prefabs) the "CursorIndicatorParent" only shows as a opaque blank white square. It doesnt have the transparent hole in the center it does like yours. I am using Unity 2022.3.0. Can u help me? Otherwise, fantastic tutorial!

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Maybe you have to set the "Render Mode" to be Transparent in the Material for the Cursor object docs.unity3d.com/Manual/StandardShaderMaterialParameterAlbedoColor.html

    • @danieletacconi5140
      @danieletacconi5140 11 หลายเดือนก่อน

      @@SunnyValleyStudio
      Ti sto seguendo ora e se permetti provo a aiutare riguardo alla domanda anche se nella mia lingua.
      Seleziona il materiale cellIndicator, in alto a destra cambia lo shader in standard. A questo punto doce c'è albedo ci metti lo sprite GridInidcator che trovi nella cartella _content. Fatto ciò basta che rimetti lo shader in sprites/default e dovresti visualizzare perbene. Ottimo video

  • @deibysantiago9639
    @deibysantiago9639 ปีที่แล้ว +1

    thank you sunny, amazing tuts

  • @ender_0967
    @ender_0967 ปีที่แล้ว +2

    ❤ Thanks Peter, this tutorial is fantastic, It helped a lot!

  • @Tozerus1
    @Tozerus1 ปีที่แล้ว +1

    Thank you for the great tutorial!

  • @Joseph-ud1sd
    @Joseph-ud1sd ปีที่แล้ว +1

    This Video helped me a lot! Thank you!

  • @mcredbunny5542
    @mcredbunny5542 10 หลายเดือนก่อน +1

    Thanks for the tutorial but where is the project you mentioned at the start of the video?

    • @SunnyValleyStudio
      @SunnyValleyStudio  10 หลายเดือนก่อน

      If you mean the extended version you can find it here courses.sunnyvalleystudio.com/ . Thanks for your support! 😍

  • @troyna77
    @troyna77 ปีที่แล้ว +1

    thanks a lot !!! i always learn when watching you tutorials. I really enjoy your udemy courses.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      I really appreciate that! Thanks for watching 🙂

  • @minhquandam7334
    @minhquandam7334 ปีที่แล้ว +1

    You are my savior !!! Thanks for the video

  • @ZiKsor
    @ZiKsor 5 หลายเดือนก่อน

    Hi, your guide is very useful, but can you tell me how to create a Coursorindicator prefab?

  • @hadiseylani2265
    @hadiseylani2265 5 หลายเดือนก่อน +1

    awsome tutorial... thanks for your clear explanations

  • @ItsPBUH
    @ItsPBUH ปีที่แล้ว +1

    These are great tutorials, always love your content :)

  • @eldarkvadrat
    @eldarkvadrat ปีที่แล้ว

    You doing good job via tutorials. Glad to watch it :)

  •  ปีที่แล้ว +1

    Your videos are amazing please share more video 😊😊😊😊😊😊😊😊

  • @vvbgamedevx11
    @vvbgamedevx11 8 หลายเดือนก่อน +1

    Thanks for the tutorial looking for something like this....

    • @SunnyValleyStudio
      @SunnyValleyStudio  8 หลายเดือนก่อน

      Great to hear! Thanks for watching 🙂

  • @zubairGamX
    @zubairGamX ปีที่แล้ว +1

    Just Amazing Sir

  • @aciloaicilo2926
    @aciloaicilo2926 ปีที่แล้ว +1

    really helpful video, thanks

  • @starfart69
    @starfart69 ปีที่แล้ว +1

    When you say you can change it to hexagon in @7:15, it would be so much better to watch if you click it just to show the viewer what changes if you do that.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Thanks for the feedback! 👍

    • @starfart69
      @starfart69 ปีที่แล้ว

      @@SunnyValleyStudio Hey, you have great content man. Your subs are criminally underrated.

  • @Cortanuh
    @Cortanuh 10 หลายเดือนก่อน +1

    Thanks for the video :)

  • @cl2401
    @cl2401 2 หลายเดือนก่อน +1

    really helpful video

  • @WEB2TV
    @WEB2TV ปีที่แล้ว

    This is wonderful tutorial! Thank you!!

  • @muhammadammarr2796
    @muhammadammarr2796 หลายเดือนก่อน +1

    Thanks for this awesome tutorial!
    but I have question, I had already watched all of the series. when I place the object with say 3x2, cursor (that take first grid with mouse cursor) already aligned with grid that has placement layer mask. But for the rest generated cursor still can place outside the grid boundaries
    how can I fix this or am I missing something?

    • @SunnyValleyStudio
      @SunnyValleyStudio  หลายเดือนก่อน +1

      You mean you would like to add Bounds to the placement area? I cover it in my paid project. Basically you need to check if each tile that your 3x2 area requires for placement is inside the bounds that you define. I do this check when we move the cursor and update the preview. Again I don't cover this in my free implementation. Sorry

    • @muhammadammarr2796
      @muhammadammarr2796 หลายเดือนก่อน

      @@SunnyValleyStudio it's okay
      again thanks for sharing :D

  • @farvardinmainyu1961
    @farvardinmainyu1961 ปีที่แล้ว +1

    Thank you Peter !

  • @mikeaelmich
    @mikeaelmich ปีที่แล้ว +1

    Maybe you have tutorial on generating a house based on outlines on a satellite map. So that users can draw the shape of their house and apply extrude

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Not yet! Sorry 🙂

    • @mikeaelmich
      @mikeaelmich ปีที่แล้ว

      @@SunnyValleyStudio, thank you for your response

  • @TheAlliones
    @TheAlliones ปีที่แล้ว +1

    Great Video!

  • @ranggasukandar3533
    @ranggasukandar3533 ปีที่แล้ว

    Thanks! super easy to understand👍

  • @richiebee33
    @richiebee33 6 หลายเดือนก่อน

    Just what the doctor ordered! I can't wait to use this in the game. I'll definitely be buying your course. One question: my game is currently using Unity 2021. Is it a must to upgrade to 2022?

    • @SunnyValleyStudio
      @SunnyValleyStudio  6 หลายเดือนก่อน +1

      As long as you are using Unity 2021.2 and above there should be no issues. This is because I am using C#9 features docs.unity3d.com/2021.2/Documentation/Manual/CSharpCompiler.html
      I am not sure about the shader part since this changes a lot (we are using a shader graph). But its something that you can convert easily - well you would recreate the shader in the older version of shader graph if it doesn't work out of the box).
      So those are the only limitations that comes to mind.

  • @Aushin510
    @Aushin510 11 หลายเดือนก่อน +1

    Hello, I am having issues with the grid being unaligned and unaffected by any changes to dragging the GridParent around. I am using the Voxel Generator tutorial you made and trying to implement this building grid system in a 3D world. I tried to follow along perfectly (swapping the floor grid indicator for a 3D visual model) but the closest i ever got to a functional (somewhat buggy) 3D grid is this:
    private void Update()
    {
    Vector3 mousePosition = inputManager.GetSelectedMapPosition();
    Vector3 gridPosition = new Vector3(Mathf.Round(mousePosition.x), Mathf.Round(mousePosition.y), Mathf.Round(mousePosition.z));
    mouseIndicator.transform.position = mousePosition;
    cellIndicator.transform.position = gridPosition;
    }
    With the GridParent Transformed to -.5 on XYZ. Depending on the face of the voxel, it either works correctly or places the grid cursor in the air beside the target block. Any help to my confusion is appreciated!

    • @SunnyValleyStudio
      @SunnyValleyStudio  10 หลายเดือนก่อน

      I am not sure but it might be but remember that the Grid component has center points in the bottom-left corner (at least in 2D). Maybe it is a matter of math - that in the voxel generator the center point is in the middle of the voxel. Maybe just adding an offset of -.5 to x and z by default would fix that?
      The error sounds like a floating point issue where since it it is on the edge of 2 grid tiles it sometimes works and sometimes doesn't, Still might be some more complex problem.

  • @emmanuelavanzi3998
    @emmanuelavanzi3998 4 หลายเดือนก่อน +1

    nice tutorial thank you

  • @ОлександрБоровський-н1г
    @ОлександрБоровський-н1г ปีที่แล้ว +1

    Great video)

  • @bluzenkk
    @bluzenkk ปีที่แล้ว +1

    cool and thanks~~ looks better and better~

  • @graheet
    @graheet ปีที่แล้ว

    You wonderful man. Thank you very much.

  • @gudfurt8464
    @gudfurt8464 9 หลายเดือนก่อน +1

    I'd like to do something similar in 2d but I'm having some trouble with the input manager. The z index of the circle I'm using as a mouse indicator is at -6.58 even though my near clipping on the camera is set to 0 (started with 0.001) and it's not following the mouse position either (based on inspector values). Any ideas why and what I could do to fix it?

    • @SunnyValleyStudio
      @SunnyValleyStudio  9 หลายเดือนก่อน

      In 2D you actually don't need the Camera Raycast. You would use "Camera.main.ScreenToWorldPoint(Input.mousePosition);"
      Next you would use that to move your Image (since in 2d we don't use spheres 🙂 unless you know what you are doing) and set it as spheres x and y position. Hope it makes sense!
      If you are using the new input system you just need to get the mosuPosition from that 🙂

    • @gudfurt8464
      @gudfurt8464 9 หลายเดือนก่อน

      Thanks for the response! I tried it without the raycast and it worked out perfectly

  • @gamedevbaiyi936
    @gamedevbaiyi936 ปีที่แล้ว +1

    Love it.✌

  • @ShahanAkhter
    @ShahanAkhter ปีที่แล้ว +1

    thanks awesome tutorial

  • @dukemagus
    @dukemagus ปีที่แล้ว

    That's a good tutorial. Do you make guides for different engines or it's an Unity-focused channel??

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Hey!
      Right now (this channel) is Unity focused. I want to do something similar for Godot in the near future. No plans for other engines though 🙂
      BTW many people have mentioned that some of the Procedural generation tutorials of mine are easily portable to Unreal engine. Code logic / architecture can easily be reused between engines. Things like Unity specific components (like the Grid component here) might be harder to translate though.

  • @강승우-p5z
    @강승우-p5z ปีที่แล้ว +2

    I`m trying to adapt your lecture for 2D Unity System. This lecture is so perfect for me and your last explanation for pivot makes me know why my tilemap dislocated little. Thank you. Let me ask you one more question... I think I can alternate Grid Component to Tilemap Component because we usually use it in 2D unity, and it is OK until but... do you think is there potential problems?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Hey! Tilemap in unity either inherits or uses grid component. I think it uses it because you get the grid component added whenever you create a tilemap. I think you can use either one.

  • @jennih835
    @jennih835 หลายเดือนก่อน +1

    Nice, Thanks!

  • @coding_game
    @coding_game ปีที่แล้ว +2

    sir cell indecator not working And download the assets from said?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Hey!
      You can check the code here (as I suspect it might be a matter of some missing line of code) github.com/SunnyValleyStudio/Grid-Placement-System-Unity-2022/commit/10d004fefbbac0dcbea0022a53b4ce3ba9c6da89
      Also make sure to set the LayerMask of the cell indicator to something other than default as in the code we want to be detecting the ground. I mention it at 5:25
      I hope it helps!

  • @CLAREBPED
    @CLAREBPED ปีที่แล้ว +1

    esse curso me ajuda muito com meus estudos, obrigado!

  • @four_corner_days
    @four_corner_days ปีที่แล้ว +1

    I'm trying this from scratch, but my cell indicator renders below the grass plane while the mouse indicator is correctly rendering above the plane. what could be causing this?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      I think we have set in a script or as a component variable an "offset" for the indicator. Check the "PreviewSystem" script if we do something like "+new VEctor3(0, someValuse, 0);" when moving the indicator.

    • @HollowGameStudio
      @HollowGameStudio 8 หลายเดือนก่อน

      I'm not sure what "PreviewSystem" script Peter is talking about in his comment here, but I found an offset solution that worked for me, as I had this same issue. For some reason I had to set my yOffset to ~0.8 to get the cell indicator high enough to stop z axis fighting.
      Instead of
      cellIndicator.transform.position = grid.CellToWorld(gridPosition);
      I used
      Vector3 cellIndicatorPosition = grid.CellToWorld(gridPosition);
      cellIndicatorPosition.y += yOffset;
      cellIndicator.transform.position = cellIndicatorPosition;

  • @Robin-xk1pp
    @Robin-xk1pp 11 หลายเดือนก่อน +1

    How do i change the width of that white part of the Coursor Indicator.

    • @SunnyValleyStudio
      @SunnyValleyStudio  11 หลายเดือนก่อน

      As far as I recall we have used a simple quad with a texture to create preview system. You can modify the texture or create the outline using a shader to be able to smoothly modify how it looks.

  • @back2back712
    @back2back712 8 หลายเดือนก่อน +1

    thank you sooooo much big brother

  • @OneRomanianGuy
    @OneRomanianGuy 4 หลายเดือนก่อน +1

    would this tutorial work with 2d as well but i just have to change some things to fit 2d?

    • @SunnyValleyStudio
      @SunnyValleyStudio  4 หลายเดือนก่อน

      Grid component works in 2D (it is used for Tilemaps). You could use the same system but your input would probably be just mouse position (no need to raycast anymore)

  • @bleedingflower6078
    @bleedingflower6078 8 หลายเดือนก่อน +1

    I have been having this issue where on one side of the plane the grid snaps all the way to the edge and on the other side it only snaps one early. This makes it so on one side it goes outside of the plane. I have been trying to offset things like crazy. The grid, the plane, the gridparent. I even tested with the sphere as grid indicator and still it indicates that it reaches the edge of the plane on one side but not on the other side. I also have tried scaling but just no change works. I am completely lost on why my grid is completely incorrect.

    • @SunnyValleyStudio
      @SunnyValleyStudio  8 หลายเดือนก่อน

      So remember how we convert the world position to grid position? Check using Debug.log what is the world position and what the grid position is. It might be that the grid has an offset and when you reach one of the edges the position is Ceiled (rounded up) ?
      Also remember that we have the grid plane and the ground plane (for simplicity of the setup). The problem might be that one is smaller than the other and when detecting positions on the edge there is actually no collider so the raycast is NULL and the returned position is from the previous row / column. This actually happened to me so maybe that is also an issue in your case?

    • @bleedingflower6078
      @bleedingflower6078 8 หลายเดือนก่อน

      @@SunnyValleyStudio thank you but I already figured it out. I noticed that it qas working correctly however by default it took the bottem left corner of the grid right on the crossing point. So all I had to do was add an offset in code of 0.5f X and 0.5f Z that put it in the center of the square and fixed it. Before that I was trying to do the offset in unity but ofcoarse that gets reset by the code. But thank you for your response I deeply appreciate the efford you put un to help everyone.

  • @jeremylock199
    @jeremylock199 ปีที่แล้ว

    Thanks a lot for this Peter. I really want a grid building system for my tank game (actually using your tutorial for that too). I want to reimagine the game Bolo on the Apple II.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Sounds awesome! Be sure to share your progress on SVS discord (link in every video) 🙂

    • @MuhammadBilal-cs3dg
      @MuhammadBilal-cs3dg ปีที่แล้ว

      @@SunnyValleyStudio can you please share the starter project link

  • @heiswatchingus
    @heiswatchingus ปีที่แล้ว

    After this tutorial I'll be a phucking billionare!

  • @pinkdolphin8017
    @pinkdolphin8017 2 หลายเดือนก่อน

    Am I required to purchase the course to get the prefabs shown in this course? Should I find alternative assets or is there somewhere I can download them?

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 หลายเดือนก่อน

      Hey! I always reference the assets used in the description "Assets used: kenney.nl/" . Just search for Furniture Kit there. I will edit the link to point to it directly 👍
      If you like the project and want to support me feel free to grab the paid version 🙂

  • @lukgoolaerts3085
    @lukgoolaerts3085 11 หลายเดือนก่อน +1

    Somehow when i follow this tutorial, the sphere (mousepointer) starts where the mouse is, but then flies straight to the camera, and i can't figure out why. Strange

    • @SunnyValleyStudio
      @SunnyValleyStudio  11 หลายเดือนก่อน

      Have you set the Spheres layer to something other than "default" ? I might have gone over this too fast. Basically if sphere has the same layer as the detection layer the sphere will be gradually moving towards the detected point - which is on the surface of the sphere. This will cause it to fly towards the camera.
      Sorry for not explaining it better in the video!

    • @lukgoolaerts3085
      @lukgoolaerts3085 11 หลายเดือนก่อน

      @@SunnyValleyStudio Yes, problem with the layers. instead in changing the layer i added it so, I had the problem you describe above. Thanks for answering

  • @dynogamergurl
    @dynogamergurl 8 หลายเดือนก่อน +1

    does this system work with controllers too?

    • @SunnyValleyStudio
      @SunnyValleyStudio  8 หลายเดือนก่อน

      If you are using the new input system you could use the controller as well 👍

  • @LDnbi
    @LDnbi ปีที่แล้ว

    Hey, great tutorial, though I am having problems with the sphere moving towards the screen when the mouse is stationary. Checked the code and it seems to be the same, not sure if you may know why this is happening?

    • @LDnbi
      @LDnbi ปีที่แล้ว +1

      Okay, I figured it out and it's so obvious now I have. I just hadn't changed the layer of the sphere, so the ray wasn't touching the plain.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      I'm glad that you have found and fixed the issue 👍

  • @wisdomkhan
    @wisdomkhan ปีที่แล้ว +1

    My cell indicator is not matching with unity grid.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      I recall that since the Tilemap tile has its center in "bottom-left" corner we have applied an offset either to the prefab or to the placement of the cell indicator of (0.5f, 0f, 0.5f). Maybe that is the problem?

  • @Rexu3030
    @Rexu3030 ปีที่แล้ว +1

    I creating project in 3d URP but i haven't this folders and scenes as you.

    • @Rexu3030
      @Rexu3030 ปีที่แล้ว

      Pls help!

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      It is best to download the full project (ZIP filed), unpack it to a separate folder and use unity Hub "open" on it to add open the same project as I have.
      The scene should be in the "Scenes" folder. Sorry for not explaining it better!

    • @Rexu3030
      @Rexu3030 ปีที่แล้ว

      @@SunnyValleyStudio thanks

  • @coverfaker8341
    @coverfaker8341 8 วันที่ผ่านมา +1

    Thanks!

  • @81gamer81
    @81gamer81 ปีที่แล้ว +1

    good stuff comment

  • @Raccoon0710
    @Raccoon0710 3 หลายเดือนก่อน +1

    What if I want to have grid 5x10, I didint find solution, how I can change grid size, it all the time 10x10, guys please help me

    • @SunnyValleyStudio
      @SunnyValleyStudio  3 หลายเดือนก่อน

      Grid calculations should work if you just set those values. Shader should work as well but you would need to set the correct scale to the shader model and I think we had some shader parameters set there as well.

  • @watercat1248
    @watercat1248 ปีที่แล้ว +1

    This remindmy Sims
    11:45 especially this part

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Awesome! I hoped it would 🙂 (otherwise I don't think people would watch the tutorial that much 😅)

    • @watercat1248
      @watercat1248 ปีที่แล้ว

      @@SunnyValleyStudio enway I'm sure I bulding editor like I will be able to be useful for other type off game's well.
      It will be easy to make Sothis like this as map editor for game.
      Or a one off the tools for sandbox game.

  • @ambiepuur1
    @ambiepuur1 ปีที่แล้ว

    Thanks for this tutorial. Unfortunately I already got stuck at the beginning. I followed every step you took with making the script and set everything where it needs to be, but when I got to 'testing getting mouse position' and click on play, the mouse won't move in the game. It's like it's not seeing the Sphere mouse? Do you have any idea why this is?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Check if the Raycast detects your plane. Remember that we use a LayerMask to limit the mouse position detection to the grass plane so the sphere will only move if the raycast detects the grass plane. Easiest way si to Debug.Log(position) inside the hit.collider != null check.
      I hope it helps!

    • @ambiepuur1
      @ambiepuur1 ปีที่แล้ว

      @@SunnyValleyStudio Thank you for the reply! I was searching and searching for what the problem was and I also thought it had something to do with the layerMask. I just found out I typed my mousePos to y and not z. That was the whole problem! Anyway it’s fixed now. Thanks again, I enjoy your tutorials and learn a lot :)

  • @PiFsc2
    @PiFsc2 ปีที่แล้ว +1

    Is there a tutorial to do this in a 2D based game?

  • @IliasTompoulidis-p4t
    @IliasTompoulidis-p4t ปีที่แล้ว +1

    Thanks!

  • @Nar1ndaa
    @Nar1ndaa 11 หลายเดือนก่อน +2

    Why we need
    Vector3Int gridPosition = grid.WorldToCell(mousePosition);
    cellIndicator.transform.position = grid.CellToWorld(gridPosition); ?
    Why not
    Vector3Int gridPosition = grid.WorldToCell(mousePosition);
    cellIndicator.transform.position = gridPosition;

    • @SunnyValleyStudio
      @SunnyValleyStudio  11 หลายเดือนก่อน

      I think this is because your cell position is relative to the grid object. If we move the object the cell position will not be the same as world position. The cell indicator on the other hand is placed relative to the world space. I might be wrong here but that was my reasoning 🙂

    • @Nar1ndaa
      @Nar1ndaa 11 หลายเดือนก่อน

      @SunnyValleyStudio thanks for answering! This part is really hard to undersand for me

    • @thegamerguyplays5275
      @thegamerguyplays5275 9 หลายเดือนก่อน

      @@SunnyValleyStudio Hi SunnyValleyStudio, could you simplify this more? what is the purpose of celltoworld? I still don't quite understand what its for. I'm quite new to programming so i'm trying to learn the fundamentals of each piece of code. I've been wracking my brain for hours trying to figure out what this does exactly 😅

  • @tomasa9690
    @tomasa9690 ปีที่แล้ว +1

    You shared used assets but the link goes to nowhere, it just opens the whole website

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      Sorry about that! kenney.nl/assets/furniture-kit

  • @SalarianStudios
    @SalarianStudios 2 หลายเดือนก่อน +1

    thanks man

  • @Sussy_Boy625
    @Sussy_Boy625 8 หลายเดือนก่อน

    would this be able to keep track of what has been placed down?

    • @SunnyValleyStudio
      @SunnyValleyStudio  8 หลายเดือนก่อน

      In the tutorial we use "GridData" object to store placed objects and their position. You should be able to easily expend this data or use it to ex "block placement of more than 3 chairs" (so to condition placement based on already placed object).
      I hope it answers your question!

  • @DaffaAP
    @DaffaAP 3 หลายเดือนก่อน +1

    this same for 3d game??

    • @SunnyValleyStudio
      @SunnyValleyStudio  3 หลายเดือนก่อน

      It depends. If you mean 3D like Minecraft you could have a grid that stores x,y,z and when walking shoot calculate the position in front of the player and clamp it to the closest grid position. The core system would work the same as here.

  • @redinternet9893
    @redinternet9893 ปีที่แล้ว +1

    Does this apply to uneven ground?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Well usually the grid is flat (even if the space includes a mountain it should not take more space than another cell in your grid) - so unless you want an irregular grid the only problem is placing the objects or drawing the grid in accordance with the vertices of the mesh. I am not really sure how our shader would work - I assume that it would handle it. In that case all you would need is to adjust the placement position so that the object aligns with the ground.
      I hope it helps somehow. I haven't tested this system with an uneven ground (like in civilization series)
      *for an irregular grid you would need a custom grid script

  • @vasilijemilenkovic1069
    @vasilijemilenkovic1069 10 หลายเดือนก่อน +1

    Great vidio

  • @prasannakuppu3165
    @prasannakuppu3165 ปีที่แล้ว +1

    Can we create this grid system at runtime?

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว

      Yes. Grid component just do the calculations for you. It doesn't creates anything scene relevant (well it needs to be added on a gameobject so it knows its origin position since it calculates the grid coordinates taking into account the position where it is placed in the world space).

  • @Hrev23.
    @Hrev23. ปีที่แล้ว +1

    its not letting me put the zip file into unity, every time I do it says I need to install a new version of unity.

    • @SunnyValleyStudio
      @SunnyValleyStudio  ปีที่แล้ว +1

      The ZIP contains a full project that you have to put inside a new folder on your machine. Next you should be able to open Unity HUB and use the "Add" button.
      The project I think was created in Unity 2022 so you can use any newer version of 2022 and select something like "convert to" or "open with" and the version you already have. Just confirm any open up window and it should open without an issue.

    • @Hrev23.
      @Hrev23. ปีที่แล้ว

      @@SunnyValleyStudio I'm using 2023 so that might be the problem...

    • @Hrev23.
      @Hrev23. ปีที่แล้ว

      @@SunnyValleyStudiohow do you make the Cursor Indicator? I want to make it from scratch

  • @bsdrago
    @bsdrago ปีที่แล้ว +1

    Great!

  • @SunghoJang-q6j
    @SunghoJang-q6j 10 หลายเดือนก่อน +2

    I like cheese burger and your lesson tastes very cheese burger.

    • @SunnyValleyStudio
      @SunnyValleyStudio  10 หลายเดือนก่อน +1

      That is the most creative comment that I had on the channel 😄

  • @MuhammadBilal-cs3dg
    @MuhammadBilal-cs3dg ปีที่แล้ว +1

    Awesome