How to change tiles at runtime in Unity (Burn your tilemap!)

Поделиться
HTML-код
  • Опубликовано: 10 ноя 2024

Комментарии • 33

  • @_Orothin
    @_Orothin 4 года назад +5

    Awesome video! Looking forward to the automatic object pool video you mentioned you're planning in the future.

  • @rahulnaik2757
    @rahulnaik2757 Год назад +2

    Awesome tutorial...looking forard to more advanced unity tutorials from you

  • @crimson_roselia669
    @crimson_roselia669 2 года назад +1

    Good tutorial! Helps me solve some problem with unity tilemap. :)

  • @benbarney9524
    @benbarney9524 4 года назад +6

    This was exactly what I needed, Thanks!

  • @MicheDépeint
    @MicheDépeint 2 года назад +1

    Amazing video I'm improving my Tilemap understanding a lot ! What if I want to keep the tile and its properties (in the tile script) but I just want to have different animations that I could spawn randomly or change through script ? Do i need another Animated Tile/Rule Tile in my scripted Tile to do it or is there another way ?

  • @deaddoctor
    @deaddoctor 3 года назад +5

    When I do SetTile(pos, tile) it only changes in the scene view but not in game, ClearAllTiles() works though.
    EDIT: I fixed it by setting the z value of pos to 0 (pos.z = 0)

  • @JonelKingas
    @JonelKingas Месяц назад

    im using super tiled maybe thats why, but if I call for change of sprite aka door from closes to open sprite, its offset by 0.5 basically in between 4 tiles and I cant find the answer, even chatgpt cant help like wtf

  • @tammy87774
    @tammy87774 3 года назад

    Thank you for this video. Really helped me

  • @HarryBGamer2570
    @HarryBGamer2570 2 года назад +1

    how can i make it so it burns in a star shape?

    • @HarryBGamer2570
      @HarryBGamer2570 2 года назад +1

      ok, i did it! I just made a check if the x and y values combined were larger than the current number of iterations in the TryToSpread method
      if (Mathf.Abs(x) + Mathf.Abs(y) > iteration) continue;

  • @Jamifa007
    @Jamifa007 2 года назад

    So, in the last video, you changed the grid's cell size from its default value of 1 to fit the sprites. I'm guessing that doesn't change how the Vector3Int works to find a specific tile, then?

    • @ShackMan
      @ShackMan  2 года назад +1

      Yes, it shouldn't matter. It's basically just a database that keeps track of which cell is next to each other, 000 is next to 100 etc. , no matter how big they are in the world.

  • @aayushtiwari1420
    @aayushtiwari1420 2 года назад

    Helped alot 😊

  • @academiadoscoins9034
    @academiadoscoins9034 Год назад

    My unity editor crashed!
    Every time I run your script the editor crashes and I have to force it to restart.
    There is a bug in your code

  • @jadivods
    @jadivods 4 года назад +2

    I'm trying to make cellular automata in unity's tilemap and I was thinking of reworking the fire from this into a tile updater, however I feel like there is probably a better way to get every tile position and update them, if so, could you perhaps make a video on that?

    • @ShackMan
      @ShackMan  3 года назад +1

      I think I would first loop through them and add every tile to a list. Use Tilemap.origin to get the lower left corner and Tilemap.origin + Tilemap.size for the top right corner. Then when you want to update the tiles, you can just use a foreach loop on the list where every tile is. Depending on the size of the tilemap, this might be quite performance heavy. Greetings

  • @anthemsofnations
    @anthemsofnations 3 года назад

    Hello! I've done everything except for using the same fire prefab that you used and nothing is really working. I've been trying to solve this problem but I can't figure it out. I'm not even sure if the prefab is the problem.

    • @ShackMan
      @ShackMan  3 года назад

      Sorry, late answer... You have to be more specific, is there an error message?

  • @pavelholub6275
    @pavelholub6275 2 года назад

    Content of this tutorial is Awsome. Story and complexity of series is great, but that names o variables in script are pain for newbies. Like Vector called mouseposition which you set as ...Input.mousePosition, same with data and others. To become Brackeys no.2 you need to be more newbie-friendly. But anyway this is 9 stars of 10, because unique content. Definetly like this channel.

    • @ShackMan
      @ShackMan  2 года назад

      Thanks for the feedback! At the current rate my channel is growing I will be Brackeys no.2 around the year 2350....

  • @boreal3255
    @boreal3255 3 года назад +1

    Snippet for a tilemap editor: map.SetTile(grid.WorldToCell(cam.ScreenToWorldPoint(Input.mousePosition)), tile);

  • @TheDonuts97
    @TheDonuts97 4 года назад +1

    How do you get the current position of the tile you want to change?

    • @ShackMan
      @ShackMan  4 года назад

      I'm not sure what you mean, the first tile clicked? Can you describe more or give me a timestamp or line of code you are referring to? Greetings

    • @TheDonuts97
      @TheDonuts97 4 года назад

      @@ShackMan I don't have much of a full understanding of the tilemap system in Unity so apologies if I can't explain properly. All I'm trying to do in my game is replace a tile with another at runtime, similar to when you change the tile to an ash tile. To do that you need to know the position of the tile burning. In the code at 3:00 you define it, but I'm having trouble seeing where that position is actually connected to a tile in the editor.

    • @ShackMan
      @ShackMan  4 года назад +1

      @@TheDonuts97 at 8:54 is where we check for a mouse click and convert that from screen position, where the mouse is, to a grid position. Let me know if that is still unclear, it helps me to know how well people understand my videos.

  • @annoyed2303
    @annoyed2303 3 года назад +1

    Clicking the link for "the part where the tiles are changed" just sends me to 0:00?

  • @firewalkswithme
    @firewalkswithme 3 года назад

    OMG GOOD JOB thank you

  • @hc5831
    @hc5831 4 года назад

    Great video. Can you post this code on Github?

    • @ShackMan
      @ShackMan  4 года назад +4

      Thanks, good idea! I've uploaded it and added a link in the description. I'll try to upload the code for all future tutorials. Cheers

    • @hc5831
      @hc5831 4 года назад

      @@ShackMan Thanks. You are providing good intermediate tutorials. I appreciate it. :)

  • @BSCRIBE-oe6kx
    @BSCRIBE-oe6kx 7 месяцев назад

    BSCRIBE!

  • @BSCRIBE-oe6kx
    @BSCRIBE-oe6kx 7 месяцев назад

    BSCRIBE!