HOW TO KILL AND RESPAWN PLAYER-Unity Tutorial

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

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

  • @bblakeyyy
    @bblakeyyy  4 года назад +13

    At 1000 subscribers i will be making a BRAND NEW CHANNEL purely for high quality game dev TUTORIALS so make sure to subscribe now to get access to free tutorials! :)

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

      the script doesn't work anymore

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

      @@alexandrux6744 it does work

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

      @@bblakeyyy can you make an video eith kill player script for moving enemyes

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

      @@alexandrux6744 when I reach 1000 subs I’m making a new tutorial channel

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

      @@bblakeyyy can i have some help please? When the level resets is there a certain way to stop certain things from resetting? For example my music?

  • @idkidc1885
    @idkidc1885 3 года назад +35

    HOW CAN THE SMALL RUclips CHANNELS HAVE SO MUCH BETTER TUTORIALS THAN THE BIG ONES

  • @goldenchipsempire
    @goldenchipsempire 4 года назад +22

    The best tutorial ever! So easy for beginners to follow. Thanks!

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

      Glad it was helpful!

  • @Goggi_
    @Goggi_ 2 года назад +9

    It's crazy how good of a video this is, it's so simple and well explained, thank you! :D

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

      It seems simple... But it didn't work T^T

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

      @@ronttu6001 🤔worked for me

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

      @@Goggi_ gonna try that again tomorrow... Maybe I just messed something up '\_("3)_/'

    • @ronttu6001
      @ronttu6001 Год назад +1

      I got this working and now I'll need a launch pad... That didn't work, maybe I'm just Bad at coding :(

    • @Goggi_
      @Goggi_ Год назад +1

      @@ronttu6001 Nah coding is just pure pain :/ but good luck to you. :D

  • @mostlikesonayoutubevideo2974
    @mostlikesonayoutubevideo2974 2 года назад +2

    took me weeks to figure this out until i saw your tutorial. Thanks so much!

  • @flamingooooz4926
    @flamingooooz4926 11 месяцев назад +1

    again your 4 year old tutorial helps me out, thanks

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

    Bro honestly this is the only tutorial that worked, thank you

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

    these videos help a lot man thanks!! please keep it up helping me make my first platformer!

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

      Michael Geraghty thank you bro! Make sure your subscribed for more :) I’ve got a start menu video coming out later today❤️🤚🏻

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

    Dude I LOVE YOUR TUTORIALS MAN. THANK YOU!!

  • @nhggr
    @nhggr 3 года назад +3

    Thank you so much
    I love how you explained it! Very easy to understand what is happening.

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

    Bblakeyyy you are amazing i wish you had more subscribers you deserve the most!!!

  • @MasonWolf90
    @MasonWolf90 6 месяцев назад

    Thanks, this helped out a lot and I loved how short it was

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

    just watched an hour video and it didn’t work... but this one did,, thank u so much

  • @endyproductions6209
    @endyproductions6209 2 года назад +2

    the great thing about this is you make new scripts for new features so if I use someone else's code for say movement then I can use your death script!

  • @TroutTastesLike5.56
    @TroutTastesLike5.56 3 года назад

    i was going through video after video, trying to find respawning script that restarted the whole scene and none of them worked until i tried this one, thanks for the good tutorial!

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

      Make sure to subscribe to the new tutorial channel!

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

    you should have put in the video that the player character needs a rigidbody2d and boxcollider2d for this to work, mine didnt work until I added those

    • @TealsStarFish
      @TealsStarFish Год назад +1

      @Toast34251 he is one with the gods

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

    You are an absollute legend. You are getting a SUB.

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

    You just saved me on my assignment, thank you so much!!!!!

  • @MalcolmEklund
    @MalcolmEklund 5 месяцев назад

    this video was very helpful even though im working 4 years from which this video was made.

  • @richardmaia8732
    @richardmaia8732 3 года назад +3

    Not working the " void OnTriggerEnter2d(blablabla)"

  • @Jay-ov4qo
    @Jay-ov4qo 2 года назад

    after 3 years, this still works.

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

    I thought it didn’t work until I realized i set the death wall to a Box Collider, not a Box Collider 2D.

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

    You deserve more subssssss!!!!

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

      Thank you🙏🏻🙏🏻

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

    Amazing tutorial I know I’m really late but thank you!

  • @kristianjuric272
    @kristianjuric272 7 месяцев назад

    Thank you!! This helped me so much.

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

    This was very helpful. Thank You :D

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

    Easy and straight to the cheese thanks mate!

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

    You just carried me through a game design class, this was super helpful thank u

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

      hahaha awesome. glad to hear it

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

    I was looking for gold, I got a diamond! thanks you so much.

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

    thank you so much, helped me a lot :)

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

    im getting this error: Assets\Scripts\RestartOnTouch.cs(24,13): error CS0103: The name 'SceneManager' does not exist in the current context

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

      I'm looking back through this did you ever find a solution I'm getting the same problem

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

      @@jambon9613 i dont remember this, its probably something really easy, im sorry i cant help much

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

      @SHINSANE nah its no problem I think I got it sorted so I hope it doesn't happen again

  • @danimation2005
    @danimation2005 3 года назад +3

    It said the script needs to derive from MonoBehaviour which I don't understand

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

    this channel should have more subs

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

    good video, question: did you have a stroke writing your username?

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

    how do you do this with a checkpoint, I dont wanna make players anger of having to re-do entire levels from the beginning. So of course if they die before every finding 1st checkpoint restart from beginning, but if checkpoint found. Start game at that point.

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

    Thanks this helped me allot.

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

      Tom Gragor no problem make sure to sub for more :)

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

    really helped me out,thanks!

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

    it says this when i do what you said Assets\KillPlayer.cs(24,44): error CS1002: ; expected

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

    thank you very much!!!
    very helpfull video :)

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

    thanks so muuch bro this is so helpful

  • @AK-gt4zc
    @AK-gt4zc 3 года назад +1

    thx man helped me alot

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

    very great tutorial dude

  • @depressedutchman
    @depressedutchman 7 месяцев назад

    the kill function works but the respawn seems to be broken... it just unloads everything

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

    amazing tutorial

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

    ok ithink unity hates me i cant make this work either on C# or Bolt i dont know whats happening

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

    Thanks dantdm this helped me big time

  • @MrAstro-by7te
    @MrAstro-by7te 4 года назад

    dude, thanks that really helped me alot:)

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

    Thanks this helped a ton

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

    I edit a little bit in code and it work well in 3d

  • @voltorian-minecraft
    @voltorian-minecraft 2 года назад

    i'm trying to make a hazard that can be bypassed if the player is in a certain state. how would you do this? say the player script has a boolean "invulnerable"

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

    This guy gets a like a sub and a comment from me thank you so much its so simple and easy and how you explain everything afterwards is just so nice so truly thanks besides the fact that my enemy just disappers afterwards T.T

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

    I keep getting error CS0246 and it says Int cannot be found are you missing a directive or an assembly reference

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

    hello, am trying to make a death animation/ death transition but idk how to do that. ( pls help if u can )

  • @tomas.menniti
    @tomas.menniti Год назад

    help: when i reload the scene my PlayerController script gets broken (i can no longer move my player using W A S D keys). Someone knows why?

  • @thom333s
    @thom333s 8 месяцев назад

    You probably don't read comments on this video anymore but it's kinda slow at spawning like after my character touches the death object it takes about half a second.
    Do you have any ideas as to why?

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

    I tried doing this with a Enemy patrol when he's moving back and forth but for some reason my enemy just falls off the entire platform when I press play

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

      That's because of the 2D Box Collider has the "Is Trigger" checked, you can add a second 2D Box Collider that has "Is Trigger" unchecked. It should fix it for now.

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

      @@carloshilario6201 Thx 😎

  • @akakop1849
    @akakop1849 5 месяцев назад +1

    Thanks!

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

    thank you for best tutorial 👏👏👏

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

    This helped thank you so much

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

    Very helpful!

  • @anthonysmith5640
    @anthonysmith5640 Год назад +1

    does anyone know how to convert it to work in a 3d game?

  • @idontknow-_-..
    @idontknow-_-.. 3 года назад

    watch a hard ass 21 minute tutorial x Watch a 933 subscribed guy with ez tutorial ✅

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

    I have a problem where after the scene resets the kill player script goes away until i leave playmode

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

    doesnt work for me, i collide with the block and nothing happens

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

    Thanks for showing bro :)

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

    i have a gun script and i cant use it after my respawn how can i fix that

  • @blurple9806
    @blurple9806 3 года назад +2

    can someone help me It dosent work but it says there are no errors
    tag player has: Player
    Scene name: SampleScene
    This script is in the object that is suposed to kill the pkayer
    Respawn: 0
    Scenes: one scene
    the Player just stands on it
    code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    public class dying : MonoBehaviour
    {
    public int Respawn;
    // Start is called before the first frame update
    void Start()
    {

    }
    // Update is called once per frame
    void Update()
    {

    }
    void OnTriggerEnter2d(Collider2D other)
    {
    if (other.CompareTag("Player"))
    {
    SceneManager.LoadScene(Respawn);
    }
    }
    }

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

    ty because im making my first working game :D

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

    bblakeyyy more like bracky

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

    ty this helped me out!

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

    You just earn a like and sub my man thanks alot

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

    In my visual studio, it's saying 'Respawn': member names cannot be the same as their enclosing type.
    It won't let the game play without it being fixed so how do I fix this?

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

      I dont know how to fix this but if u still need help i fix the problems by looking at what it says than looking at my code and seeing if i can connect things

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

      @@IsabelLovesFoxes Ehhhh I kinda gave up on that project

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

      @@eeveelegion5916 well if you ever work on another do that its fixed like 70% of my errors

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

    İt says that The name SceneManager does not exist in current context can you help me?

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

      Nvm solvent it by adedini scenemanagment thingie ::))

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

    I did this in 3D and for whatever reason I’m not dying, do you know why?

  • @alwaysalegend63
    @alwaysalegend63 3 года назад +2

    Low budget brackeys

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

      You’re not wrong

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

    The Type or namespace 'SceneManagement' Does not exist in the namespace 'UnityEngine'. Are you Missing an Assembler reference? Pls help me

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

      Remember to use unityengine.scenemanager at the top of the script

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

      @@bblakeyyy i Type that and i got the Same error

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

    What do I do? 'New to coding'
    error CS0103: The name 'SceneManager' does not exist in the current context
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class EnemyofSousa : MonoBehaviour
    {
    public int Respawn;
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
    }
    void OnTriggerEnter2D(Collider2D other)
    {
    if (other.CompareTag("Player"))
    {
    SceneManager.LoadScene(Respawn);
    }
    }
    }

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

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.SceneManagement;
      public class KillPlayer : MonoBehaviour
      {
      public int Respawn;
      // Start is called before the first frame update
      void Start()
      {

      }
      // Update is called once per frame
      void Update()
      {

      }
      void OnTriggerEnter2D(Collider2D other)
      {
      if (other.CompareTag("Player"))
      {
      SceneManager.LoadScene(Respawn);
      }
      }
      }

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

      @@InspeWave Yis3ed dinak shoo ini ba7ibak

  • @supreme-doggo9680
    @supreme-doggo9680 3 года назад

    why does respwan change scenes colour?

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

    I have a problem I have the whole script right but its not working at all. But still great tutorial ;)

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

      Same here did you figure it out

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

      If you join the discord server we can help you out more

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

    Necromancy at it's best

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

    it still works 3 years later lol

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

      What Unity version are you using?

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

    Thank you bro!!

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

    worked epicly very cool

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

    it just keeps going through it help please help

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

    also i used your moving tutorial in your second channel

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

    help me doesn't work it just fases thru brick

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

      you need to add a box collider 2d to the thing you want to kill the player

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

    Why did you make all your videos private for a while

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

    when i hit the object that is supposed to kill the player nothing happens

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

      felsflop Go into inspector mode and check that your collider’s IsTrigger function is on.

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

    It doesn't work for 2019 doesn't it

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

    my one doesnt work and says "the script needs to derive from monobehaviour" do you know whats wrong?

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

      The name of the class has to be exactly the same as the script name next to monobehaviour

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

      @@bblakeyyy ty this helped alot :) keep up the good content

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

    thanks a lot
    it was helpfiull

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

    hey, i followed all the steps, but my player goes right through. Any tips?

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

      Make sure the enemy has a box collider which is not a trigger

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

    i did every step and it didnt work

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

    Thank You very much :D

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

    What to do if it doesn't work😨

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

    Mine just acts like if it destroyed the player.

  • @Blockhead-xc3dq
    @Blockhead-xc3dq 5 лет назад +1

    Thanks!😀

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

    The referenced script (unknown) on this behavior is missing! warning I am getting every time

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

      AquaIgnisium the name of the script has to be the same as the name at the top inside the script, on the same line as mono behaviour

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

      @@bblakeyyy that did not work

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

      @@aquaignisium7089 try recreating your script , change the name to something simple like 2 or 3 letters and then copy and paste your last script but without the pre-written things. i don't know the warning but when bblakeyy said to change the name i thought this idea might help more since unity does all the job and connects everything on its own

  • @Zero-ms2pi
    @Zero-ms2pi 3 года назад +1

    it sadly didnt work for me ;((

  • @user-ir5qg4rd1i
    @user-ir5qg4rd1i 4 года назад

    I have exact same code as you but i dont respawn and Just phasr trough it