Part 28 - Switching Scenes: Make a game like Zelda using Unity and C#

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

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

  • @ximinas
    @ximinas 4 года назад +47

    Not even making your Zelda game, but applied this to my game. The fact that your video is so easy to follow and usable for different games is awesome! Keep it up!

  • @thecuchikiller
    @thecuchikiller 3 года назад +32

    3:22 Note for some people: Don't forget to had add the "Player" tag for the character.
    You can do this finding the object and in "Inspector" top left in the panel, there is the tag selection option.
    "Player" is a default tag by Unity.

  • @bran8370
    @bran8370 6 лет назад +33

    Just what I needed! This is great! Now we can make towns, fields, etc. Thanks for sharing your knowledge!!

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

    Thanks man, you' re a lifesaver.
    I used this tutorial to implement correct scene changes in my platformer, and it's THE ONLY tutorial that worked for me, for my needs.
    Again, thanks!

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

    Gradually progressing through these tutorials. They are absolutely wonderful. The pacing is great, and you do an excellent job explaining things. These tutorials have answered so many questions about how to do things that I had no idea how to approach previously. 10/10.

  • @scottisitt
    @scottisitt Год назад +3

    If you want the Player to be facing the correct direction after entering the house, you can make another Vector2 field (ie: playerDirection) and set it up in the SceneTransition script the same way that you did for playerPosition. You’ll need another field in the VectorValue script to store that value as well.
    When you enter the X and Y values for playerDirection in the inspector, you will want to set X at 0 and Y at 1. This will ensure Player is looking into the house (up) after entering. For the transition out of the house, you’ll set Y to be -1, so Player is looking down.
    In order to apply the direction in the PlayerMovement script, you will access the animator in the Start() and use animator.SetFloat()…
    animator.SetFloat(“moveX”, startingPosition.startingDirection.x);
    animator.SetFloat(“moveY”, startingPosition.startingDirection.y);
    You can see at 9:12 in the video that he already has animator.SetFloat methods set up. So you can modify them with the above code.

  • @juasjuasi4750
    @juasjuasi4750 3 года назад +6

    heads up! any modification you want to apply to all instances of a prefab, you should always do it in the prefab editor and not on the scenes. This can cause headaches especially if you remove or add components to the instance and not the prefab itself.

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

    Your voice is so calming, i just love it. Also the tutorial is very good. Helped me a lot.

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

    Most relaxing and easy to follow tutorial on Unity I've seen so far! Earned an easy subscription from me :)

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

    Thank you so much for this! It was exactly what I was looking for! I also found it useful to see the troubleshooting, so thanks for not editing that out.

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

    I originally did this by saving the player position using the unity save system and loading it on the scene start....this seems like a much better way thank you

  • @musashik4483
    @musashik4483 5 лет назад

    I am really enjoying this series and I hope that you continue working on it.
    I had an issue with getting the Scene Transition to work and then when we got the error about the HouseInterior not being loaded I realized that I had never added SampleScene. Fixed both problems.

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

    This tutorial was super simple and easy to add to my game, thanks! Using it for a platformer and it works perfectly fine!

  • @falconhorus495
    @falconhorus495 6 лет назад +1

    Hi,
    I just wanted to say I really enjoy and appreciate your tutorials. They're very helpful, and just wanted to offer my encouragement. Keep up the good work :)

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад

      Thank you so much! I've had a family emergency come up, but I'm going to try to get some more videos up this weekend!

  • @ClancyXanecrest
    @ClancyXanecrest 5 лет назад +5

    AVOID MY MISTAKE: I created a player prefab to have in each scene, and I dragged the prefab from my assets into my vcam follow slots, and the vcams I did this for stopped working but I didn't catch this immediately and then spent like 3 hours trying to debug. ONLY ONLY ONLY set vcam follows to instantiated instances, not asset prefabs. It is now 4:42am, what a horrible night haha.

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

    Hey you can simplify the scriptable object here. Just have it store the value of your transform. Position outside the house before you enter. Then you can use that on scene load when you leave. That way you dont need to find the position for every single door you wanna make and itll just overwrite the previous position stored in memory when you trigger a new door in your over world.

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

      Good point. Thanks for your suggestion!

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

      Wouldn't this end in a endless transitioning, because the position it saves is on the transition position?

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

      yes, you want to include a Vector2 offset that you can adjust in the inspector to be safe that you don't spawn in directly on the trigger outside. usually, just make the trigger box collider thin and include a 0.5f offset in whichever direction you're supposed to be spawning in from.

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

    you helped me out so much! thanks for the tutorial

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

    Btw at the end, the player didn't immediately trigger it- otherwise the scene would switch. The scriptable object had just shifted its value on the previous run without ever switching scenes. (Because of the error Unity threw.)

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

    THIS CHANNEL IS GREAT! This legit the only tutorial that has worked! thanks!

  • @sgtfoose8842
    @sgtfoose8842 4 года назад +3

    Pff this was a tough follow. It took me until 15:45 in the video to found out why my Transition trigger didn't work! With our current code, we can only enter the Player Position Initial Value once. So if I make it work for my overworld (scene with th house), it doesn't work for the House Interior scene. This isn't much of a problem since we would always start the game at the same place, but I guess later when we add "Save Game" and "Load" our last position, this could be a challenge. As with all previous videos, i'd would recommend new followers to wait with troubleshooting until the end of the clips if possible. Anyway great video!

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

    Please help me. I cannot create Vector Value. When choosing to create only Projectile Ability only. I am really hard 😓

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

    i have watched like 20 tutorials and yours is the best one! love u so much

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

    For anyone struggling and hasn't considered this particular issue, I hit a wall for weeks but turned out I needed to set the player's rigidbody to kinetic. two static objects can't interact as the physics engine expects them to remain still so if the trigger is static then make sure the player is not static too

    • @iop313
      @iop313 4 месяца назад

      thx

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

    This is fantastic! Exactly what I wanted to do but I'm new enough I always forget to use the scriptable objects!

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

      Ha, thanks. This series was a work in progress and I'd do a few things differently now, but yeah, this was my first attempt at using SO's for an architecture.

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

      @@MisterTaftCreates I would love to hear more about what you would do differently now. If you have more videos about that please point me in the right direction!

  • @toniconge7003
    @toniconge7003 5 лет назад +1

    ooo very cool set up for making sure the player can enter from different locations!
    I hope in the future you show how to make it so I don't need to manually reset player position after each playtest but it's not even that big a hassle.

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

      While in SampleScene and you have all the values set up for transitioning between scenes go to your scriptable objects and in the "PlayerPosition" change the InitialValue (in the inspector) to what ever you want your players position to be in the overworld

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

      @@DannsArmy This is what I do but everytime the scenes transition, the initial value just changes back to where the transitions take place. For example, I start on one side of the map and in my game I walk a bit before touching a door to a house which changes the scene to inside the house. I can walk back out just fine, but when I come out of play mode and back in, the value changes it starts me in front of the house instead of my starting point.

  • @wazaq
    @wazaq 6 лет назад +2

    I just wanted to add to the comments in case someone else notices it (not sure if it's seen/covered in a later vid). The reason the camera still jumped after you set the position in the start is because the left side of the camera would be "out of bounds" when the scene loads, so it shifts right it it's in bounds. With the exception of moving the whole house to the right (if it was only that easy IRL) or doing some kind of zooming effect, i can't think of a way to stop that.

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад +1

      you can add a quick little method to center the camera on the player's position in the start method, but then you might end up with a race condition between the camera's position and the player's position.

    • @tacticalmythic7945
      @tacticalmythic7945 5 лет назад

      @@MisterTaftCreates pls show me how sigh..

  • @borjadetorres7747
    @borjadetorres7747 2 года назад +5

    So I have an issue. The values we set for the position during the transition are apparently permanent values. When I start with scene A it goes directly to the door that goes to scene B, instead of the original position in the scene. How do I change this?

    • @RetroRedDog
      @RetroRedDog 10 месяцев назад

      Did you resolve this? if so how

  • @eggqwq
    @eggqwq 4 года назад +9

    Im so confused because whenever i make the scene transition a trigger then write all the code and do whatever the tutorial says then walk into the door, it just makes my player do the crouch animation! This is driving me INSANE!

    • @Jimmiejam87
      @Jimmiejam87 4 года назад +8

      Yeah my transition didn't do anything at all, I had to click File > Build Settings - then "Add Open Scenes" for each scene loaded

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

      @@Jimmiejam87 I had to do this too

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

      @@Jimmiejam87 Thanks for this. I was stuck here as well.

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

      @@Jimmiejam87 Hi, Thanks. I was struggling. You need to drag both scenes to the Building Settings screen. Thanks a lot!

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

      @@Jimmiejam87 That just saved me i couldnt figure out what it was @Jimmiejam87

  • @themariolinkplushteam5919
    @themariolinkplushteam5919 3 года назад +4

    One thing: Is it possible to make multiple scenes use only one instance of the character? For example: the way it is now, if u take damage in the overworld, u lose half a heart, but if u go into the house, it doesn't save that, and the hearts max out again, but if we use the same instance of player, I imagine it would use the same data and info (eg the health) globally and not locally for each scene

  • @CarnivorousSuperIntendent
    @CarnivorousSuperIntendent 4 года назад +3

    so when i do a scene transfer from overworld to house interior after doing a room transition and transfer back to the overworld the camera jumps to the starting position of where the player started from before the room transition. anyone else having this issue?

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

      i have this problem too :(

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

      @@miadevv1505 it was solved in the Cinemachine tutorial later on
      but the camera movement script and the room transfers are no longer needed because they are replaced with Cinemachine's virtual camera system Cinemachine is a package on unity

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

    I dont know if i think correctly that the scriptable obj will modifed the value even I had ended the game , it means I have to change back for the scriptable obj PlayerPosition to the default value

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

    Sprite of the gate is not loading the transition is there and works perfectly

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

    Good day! It says here in my Visual Studio 2019 that VectorValue could not be found. What will I do? Thanksss

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

    There's a way to always start in one position after start the game before i make the switching scenes? it's the only problem i can't solve until now.

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

    I'm working on making a 3d version of the Nes game Crystalis and your tutorial was just what I was looking for. but I did run into an issue with loading the scene. its fine when you first walk through the door but if you do it again the player wont be set to the proper location. instead going back to the original place the player was. not sure if its just a version thing or if its because I'm making a 3d game.

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

    Hi Mister Taft! Amazing tutorial, but i have a doubt.. Vector Value doesnt shows in my menu when i try to create. Do you know why? I 'll appreciate too much your help :)

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

    I spent so long using the previous method creating maps

  • @Lajlaj
    @Lajlaj 3 года назад +4

    Amazing tutorial, but is there any workaround if you want to only load these position values when transitioning between certain scenes. Because now everytime I hit play, my character loads at the Vector Value, same if my character dies. It reloads the scene, and spawns my Player at the last Vector Value.

    • @RetroRedDog
      @RetroRedDog 10 месяцев назад

      Did you resolve this? can you tell me how

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

    new to unity, followed the instructions sometimes all it says trigger entered and nothing happens and sometimes goes to another scene but without the character.

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

    This video is a life saver, thank you!!

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

    Thank you!!! I have needed right this! Big like!

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

    this is literally everything i was looking for!!!
    (also, using a mac? big respect man!)

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

    why my 10th line in SceneTranstision, "public VectorValue playerStorage". identify as namespace, not a type... stuck on this one, any solution?

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

    Very nice and helpful 😁👍
    Thanks a lot

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

    how do you create a vector value??

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

    64 more episodes to go!

  • @iop313
    @iop313 4 месяца назад

    this realy help me with one scene but when i tried to create for multipol scenes it didn't work (only for one) Can u pls give me a hint or if u have a video for the issue I have I be happy to see thank u

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

    I am very new to programing i wanted to do a scene transition and have spent the past two days after work trying to make it work. Spent hours watching 5 diffrent videos trying to see if any of them worked. But it didn't. Why? because i forgot that boxcollider and boxcollider2D are two VERY diffrent things. But i found this great video because of it so im glad!

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

    Anyone having issue with this method after creating a build ?
    My scriptableobject VectorValue doesn't seem to work
    (But in the editor it works prefectely)

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

    You are my hero, thank you a lot!

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

    this is an amazing tutorial but the vector value optio wasnt popping up. did unity remove this feature in later versions? I am using 2021.3

  • @charlesgillett6334
    @charlesgillett6334 6 лет назад +4

    This has been the best tutorial for making this type of game. Great way of explaining the code. When will you release the next video? Also, do you have any experience with creating a battle system (similar to pokemon red/blue or undertale?)

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +2

      Thanks so much. The next few videos are recorded but not edited yet. I'll try to get them out over the holiday weekend, since I should have some extra time. I'm currently helping a student of mine make a battle system similar to that, and will probably add that to my list of possible tutorials for the future.

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

    Thanks for the brilliant explanation. Just a question. When the player switches a room, how can I save its status? i.e. hearts, coins, ecc.

    • @iop313
      @iop313 4 месяца назад

      simple
      on the canvas add the code
      public void Awake()
      {
      DontDestroyOnLoad(this);
      }
      this will make sure the state of ur health coins ect will stay the some (u buy or sell the amount will stay the some u took damage the HP will stay the some)

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

    can you make this for 3D pls

  • @tacticalmythic7945
    @tacticalmythic7945 5 лет назад +2

    Help pls I added a dungeon but its in a different area from the original start of the SampleScene so when I teleport out of the scene my sprite goes there but my camera goes near the house that you have in that area pls help;(

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад +2

      Hey there. It sounds like you're not resetting the camera. I change the camera system entirely later in the series, so if you jump ahead to video 46 - Observer Objects, then video 48 - Cinemachine, then it should work better.

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

    (Using unity 5.1.1f) when i out using UnityEngine.SceneManagement, it said it doesnt exist in unityEngine namespace…

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

    Amazing. Thank you so much :)

  • @jayjayjaythebrand
    @jayjayjaythebrand 6 лет назад +1

    Can you please show us how to add cutscenes?? Thanks so much for these tutorials man!!!

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +4

      Thanks. I can add that to the list of stuff to add :)

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

    hey nice tutorial! but i have a problem, when i load a scene and switch back to the other scene then i cant press any buttons can someone help pls??

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

    I'm a bit lost. When I transition, I don't see my character at all.

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

    MTC just to make things easier for myself. when i swap scenes in the trigger can't i just place i game object at that potition on that scene and the player will appear on that game object when they go from one scene to another isn't there a way to do that instead of having to pass in the cordinates in the inspector??

  • @LtWittmann
    @LtWittmann 5 лет назад

    I have a problem, some of my sliced asset have lay on top of the floor or wall, but also make weird transition, like the window

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

    My player now seems to only move around the collision blocks (forest, house etc) when I do the transition, any suggestion to solve this problem

  • @shadowrose00
    @shadowrose00 5 лет назад +1

    Hi i have a problem i would like my charachter to be on a specific place when i start the game (play the play button) but player position makes my charachter be on a postion that i only want when i go through a door

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

      Have you found the solution yet? I have the same problem as well.

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

      @@faiz7180 i guess, because it saves the settings when you use a "scene transition". Just had the same problem :)

  • @kaptainriflebeard5980
    @kaptainriflebeard5980 5 лет назад +1

    I have a problem. The sprite for the door when I made it into a scene transition isn't showing in the game scene. Help please.

    • @gabrielpesch5247
      @gabrielpesch5247 5 лет назад

      Did you fixed it?

    • @kaptainriflebeard5980
      @kaptainriflebeard5980 5 лет назад +1

      @@gabrielpesch5247 I did actually. Someone on discord helped me on it. So basically just make sure the sprite's Z axis is 0 and the sorting layer is above the ground

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

    this transaction can use with another movement script?

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

    I've been having a problem where my character is either moving normally or is sluggish every time I hit play.

  • @danielcjtodd
    @danielcjtodd 6 лет назад

    this series is so awesome. I'm looking forward to the next set. This deserves so many more views. I'm kind of waiting for it to finish though before I begin it (like the candy crush one you did) so I know what i am aiming for. Is there any reason that you are releasing these one at a time? Thanks again for your knowledge!

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +1

      Hey there. I was trying to release one a week, but I've had some personal life issues come up and they haven't gone away. I'll try to get a video or two up over this long weekend, though. Thanks.

  • @vlversus
    @vlversus 6 лет назад +1

    i have a question for you, can you show us how to make a chest system pls i am very confused and i need your help

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +1

      Hey there, and thanks for commenting. Yes, chests are coming soon :)

    • @vlversus
      @vlversus 6 лет назад

      @@MisterTaftCreates thank you for replying, keep up the good work

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

    Question
    I dont have any of the prefab buttons like apply on the inspector. Im in a newer version i guess. What should i do?

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

      there should be a drop down menu on your prefab called overrides where you can find the apply button

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

    Edit: fixed it, my dumdum plugged 2 SceneTransition scripts into the SceneTransition and didn't plug the position and the PlayerStorage into one of them.
    I have a weird problem: everytihng works, the code is the same, but whenever I go out of the house it shows
    "NullReferenceException: Object reference not set to an instance of an object
    SceneTransition.OnTriggerEnter2D (UnityEngine.Collider2D other) (at Assets/Scripts/SceneTransition.cs:17)"
    But everything works perfectly. What could it refer to? Line 17 is the " playerStorage.initialValue = playerPosition;" and I've plugged everything in the Inspector, SampleScene, position and PlayerStorage 0-0

  • @tcbsuperhoop89
    @tcbsuperhoop89 5 лет назад +3

    Hi. I played around with the code to see if I could make the player face the right way when entering the house - as in into the house not facing where he came from. I'm going to share it if anyone else wants to use it:
    In Vector Values add in public Vector2 whichDirectionFacing;
    In Scene Transitions add
    playerStorage.whichDirectionFacing = playerFacing; to the if
    In Player Movement change the Start to this:
    animator.SetFloat("moveX", startingPosition.whichDirectionFacing.x);
    animator.SetFloat("moveY", startingPosition.whichDirectionFacing.y);
    Then the direction can be set in the Scene Transitions in Unity

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад +1

      Hey there. You actually don't need to do that. Just change the default sprite on the player in the scene that you enter a door from. Just choose the upward facing player sprite and put that in the sprite renderer. The animation will still work and change when you move.

    • @Axodus
      @Axodus 5 лет назад

      @Mister Taft Creates
      Didn't work for me, Instantly starts facing towards the screen again when I run it.

  • @BurgerParty
    @BurgerParty 6 лет назад

    btw thanks for this awesome tutorial you deserved a liked views and subs

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

    Not the way I ended up doing it, but definitely pointed me in a better direction.
    *Check the reply for some neat code*
    I was looking to see how other people do it, because setting it up, switching from scene to scene is tedious, and time consuming.
    Which is what you do here... :(
    But seeing you using Scriptable objects, inspired me to make a better solution (in my opinion).
    Make an editor extension script (easier than it sounds), adding an option in the context menu (the three dots) of your TeleportScript (or whatever you call it).
    This will make it a lot easier to reproduce this process, so you can map out your entire scene in 10 minutes.
    In the context menu method you will be able to access the properties of the component, adding new scripts to the GameObject, and create assets from script.
    What the context method will do is create a scriptable object asset using the transform's GameObject name, the scene name (all objects have a reference to their scene), and the coordinates (I'm working on a 3d project, so I also record the transform's rotation, for a proper portal).
    The TeleportScript will simply have a reference to a Destination scriptable object, slot in any you've created using the method above, and presto, you're done.
    It may have taken you an hour to get this set up, but now you can create the destination points in a matter of minutes, and you will have many in this sort of game, so it's worth it.
    Finally, your workflow will look something like this:
    Go to a scene, position transition points (they don't have a destination yet), click the context menu to create the scriptable object for those points, as above.
    You now have the assets to teleport to these points... but not from them.
    Repeat for another scene (or use the assets you've made so far to teleport within the same scene).
    Once you have 2 sets of assets, you can connect your scenes.
    Assign the desired destination scriptable object to a TeleportScript, and you just saved yourself hours of tedious work.
    Pro tip: position all your teleport destinations, select all of them, and then invoke the context method on all of them at once.

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

      The following is a method that needs to go to a *static class* and the file of that class *has to be in a folder named "editor"*
      Doesn't matter where the folder is, as long as it's called "editor" and you put your class file in it, it's a Unity feature.
      This method will create an asset file using the data of a GameObject that has the Teleporter script attached to it.
      A scriptable object is created, along any folders needed on its path.
      Slot-in your own class, and change the path variable to whatever you need.
      *Unity knows which type of component the method appears on by name!*
      *Change the MenuItem attribute to match your class name.*
      [MenuItem("CONTEXT/YourClassName/Your Method Name")]
      *Code starts here:*
      [MenuItem("CONTEXT/Teleporter/Create Destination")]
      static void CreateDestinationAsset(MenuCommand command) {
      var comp = (Component) command.context;
      var tpp = ScriptableObject.CreateInstance();
      tpp.targetSceneName = comp.gameObject.gameObject.scene.name;
      tpp.worldPosition = comp.transform.position;
      tpp.worldRotation = comp.transform.rotation;
      string path = "Assets\\Scriptables\\Transitions\\Levels\\" + tpp.targetSceneName;
      Debug.Log(path);
      new FileInfo(path+"\\asd.text").Directory.Create();
      string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/" + comp.name + ".asset");
      Debug.Log(assetPathAndName);
      AssetDatabase.CreateAsset(tpp, assetPathAndName);
      AssetDatabase.SaveAssets();
      AssetDatabase.Refresh();
      EditorUtility.FocusProjectWindow();
      Selection.activeObject = tpp;
      }

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

    Since this lesson the health bar (object 123) has been going backwards every time i run the program. has this happened to anyone?

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

      Yeah I had that problem, also a weird blue sprite edge at the top right of it. Seemed to fix these issues by clicking on the objects spritesheet and changing the mesh type from tight to full rect

  • @Demonfox-Lux
    @Demonfox-Lux 4 года назад

    Heeelp >\\\<
    Since I added the first Scene transition (House) to the game, my log doesn't work anymore. It doesn't chase the player neither can't the player attack it

  • @MinhNguyen-kb1ps
    @MinhNguyen-kb1ps 4 года назад

    that y i love SO, great video :))))

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

    Any Ideas on why the trigger isn't working mate? I done the script correctly but nothings happening when I walk into the box collider

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

      hi I had a similar problem I found that if you select your character and under Tag change it to player this might help also make sure the scene transition box collider is set to
      (is trigger) also you need a character in the new scene that you are going to transfer to other wise it won't work

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

      @@coreprimal1172 yeah I finally sorted it but thankyou ahah :)

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

      @@Killaisking9999 Como você resolveu? how did you solve it?

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

      @@coreprimal1172 how? My Character already in Player TAG and also my Collider also in isTrigger, but my Scene Transfer still didnt work

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

      @@sev9854 sorry, but its been a year since i posted this and I'm not even sure what this post was about anymore, my suggestion for what ever issue you have with your game is to keep searching on RUclips and im sure you will find your answer or you could do what i did and jump over to rpg maker mv or mz its a much better set up with much more control over your game through mods

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

    what about going into water tiles??

  • @p.franklion1701
    @p.franklion1701 5 лет назад

    After scene transitions my enemy does not chase the player anymore:(

  • @billynewcomb2485
    @billynewcomb2485 5 лет назад

    Would it not be a good idea to set up the scene to load so that you're able to just drop the scene into the inspector instead of having to type it in, and how would we go about setting it up like that?

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      You could totally do that. I'm not sure why but it just makes more sense to me to use a string like this.

  • @nibernator
    @nibernator 5 лет назад

    Any idea why I might be getting a NullReferenceException? The scene transitions perfectly fine.
    Says it is at just after the if statement for CompareTag for Player && !other.isTrigger.
    the line: playerPosition.initialValue = playerPosition;
    I checked, and all my fields in the inspector, they are all filled...
    How are we to know where a nullReferenceException is???

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      Did you hook up the references to the canvas for the new area etc?

    • @nibernator
      @nibernator 5 лет назад

      Okay, so, I have NO idea what happened. I think Unity just messes up sometimes and doesn't compile correctly or something. I just stopped showing up out of nowhere without me making any changes. Sorry for that. I have set up my version control (using Source Tree), so hopefully I no longer have these issues. Plus, now I will go first to your Git files first!
      Thanks for everything! @@MisterTaftCreates

  • @tcbsuperhoop89
    @tcbsuperhoop89 5 лет назад

    Hi
    I'm having problems with the camera. I have created a scene transition in the adjacent tilemap 'area' of the game - call it Area B (west of Area A). if I move my character from Area A into Area B, the camera transitions fine. I then enter a building in area B and then leave, the camera gets stuck on the very west edges of Area A. How can I get the camera to find the player in Area B?

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      Is the room transition maybe finding both of the player's colliders?

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

    is there any easy way to make a multiple vector value? The thing about my game is player need to go back and forth with 3 different scene. I'm kinda stuck on how to set the value of starting position.

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

      did you find a solution?

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

      @@Agarm122 I didn't find any solution back then. What I did was, I make all of my scenes into one scene. This way I don't need to go back and forth on different scenes.

  • @foodbaby3372
    @foodbaby3372 5 лет назад

    Hiya! Would you ever consider making a tutorial on how to make turn-based RPG combat? Like in Pokemon.

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      Hello. That is one of the topics that will be on the possible list after I finish this one.

  • @HowToLoves
    @HowToLoves 5 лет назад

    Great vids! one issue I'm having is the health bar resets after the transition to a new location... will we be getting to this in a different video? or should I tackle it? Seems like there needs to be some pub/sub between the two scenes to relay information. Or maybe keep the player? seems like something important

    • @HowToLoves
      @HowToLoves 5 лет назад

      Edit: I realize that this is only the UI might be easier fix than I anticipated.

    • @HowToLoves
      @HowToLoves 5 лет назад

      Edit: Found out why. it's because when the game starts in heartManager we always call "initHearts" which hardcodes the value back to a fullHeart even tho we are passing the floatValue around correctly and the info is there. You can work around this buy taking out the `hearts[i].sprite = fullHeart` from the InitHearts and adding a call to updateHearts after the for loop. There is also a way to pass around the values using the pub sub but it's a lot more involved.

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

    Why my caracter does not appear in the next scene ?

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

    Doing this has made it so that when I collide with pots, they break, the enemy doesnt move and all my hearts have dissapeared! Can someone pls help.

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

      ACtually, the only problem is when I walk into pots they break

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

    Muito Obrigado! Thank you!!!

  • @additional-ram
    @additional-ram 6 лет назад

    I need some help. Could you do some tutorials on Inventory, sound effects and music? I would be so happy =D

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +1

      Hey there. Tutorials on sound effects and music are definitely coming. The tutorials on Inventory will probably be a separate topic to be covered later.

  • @mrowlesstewart
    @mrowlesstewart 4 года назад +3

    whenever I move to the next area, my initial value changes and then sticks in the InitialValue when I hit stop. How do I fix this so that when I hit play for the first time, I always end up at the proper point? Currently, i have the code
    int run = 0;
    if (run < 1)
    {
    startingPosition.initialValue.x = -345.7399f;
    startingPosition.initialValue.y = 163.2162f;
    run = 2;
    }
    else if (run == 2)
    {
    startingPosition.initialValue.x = -328.27f;
    startingPosition.initialValue.y = 156.46f;
    }
    but I'm always ending up at -345 even with the scene2 values matching the code in the run 2

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

      Hello! have you figured it out? I am in the same situation right now.

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

      @@alex_opr Try using the OnAfterDeserialize method

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

    GRACIAAAAAAAAAAAS

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

    Hi I don't expect you to respond but I've encountered an error at 7:30 involving Vector value that I have no clue how to solve. it tells me line 16 that VectorValue doesn't contain a definition for initial value and no accessible extension method 'intialValue'. I have no clue how to solve this and have tried multiple time to no avail

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

      I think you misspelled "initialValue" in one of your scripts. Classic, but gut wrenching

  • @mohamadjazman9239
    @mohamadjazman9239 5 лет назад

    can you make a tutorial just like this but on 3d

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

      i got you bro

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

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.SceneManagement;
      public class loadleveloncollision : MonoBehaviour
      {
      [SerializeField]
      string strTag;
      [SerializeField]
      string strSceneName;
      private void OnCollisionEnter(Collision collision)
      {
      if (collision.collider.tag == strTag)
      SceneManager.LoadScene(strSceneName);
      }
      }

  • @gabrielpesch5247
    @gabrielpesch5247 5 лет назад

    I dont understand why my scene transition is invisible

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      I don't know why either. Check the color value in the inspector while you play. Is that value changing?

    • @ToastandBananas
      @ToastandBananas 5 лет назад +2

      Make sure the sorting layer is above the ground and the Z position is 0

  • @tcbsuperhoop89
    @tcbsuperhoop89 5 лет назад

    Hi. These tutorials are brilliant. Just wondering, if I had say five houses, would it be better to use one scene but set the coordinates to different places to maintain the illusion of different houses or have five separate scenes?

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      That's a great idea. You could also have the houses be in this scene, and just change the player's position.

    • @ninja_tony
      @ninja_tony 5 лет назад +1

      hey, if it helps you any, when Nintendo developed Link to the Past, they included pretty much all the overworld interiors on one layer (or scene in this case), and all the dungeon interiors also on one layer. So I think it is probably the best way to go. You could do it either way, but I think it would make your organization much easier within Unity to keep them all in one scene, and it would probably help with optimization as well (having fewer scenes to load in general I imagine would save on resources).

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

      I came here looking for this exact debate, thanks. My method was to use “teleportation pad” objects on different exported tile grids that connected to each other, which works pretty well so far except for the lingering camera jerk. Might temporarily remove the smoothness to handle that.

  • @fastpicker89
    @fastpicker89 5 лет назад

    What the heck is a VectorValue?

    • @ClancyXanecrest
      @ClancyXanecrest 5 лет назад +1

      It was replaced in Unity 2019 with Vector Position

  • @thedoctor1471
    @thedoctor1471 6 лет назад

    Hey man :) hope you're okay. Did you like take two weeks vacations or something ? ^^

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +1

      Hey there, no, I've had an ongoing family emergency that's taken me out of town consistently for the last two weeks. I'll try to get a few more parts in this series up this week, though.

    • @thedoctor1471
      @thedoctor1471 6 лет назад

      @@MisterTaftCreates Ow I hope you and your close ones are okay

    • @MisterTaftCreates
      @MisterTaftCreates  6 лет назад +1

      They will be. It's kind of ongoing, but I'll try to get back to making videos soon.

    • @thedoctor1471
      @thedoctor1471 6 лет назад

      @@MisterTaftCreates yeah look as much as I love your videos your family comes first. If you need anything just say. Be strong.

  • @FortbloxNET
    @FortbloxNET 5 лет назад

    Hmm somehow i think this gameobject/transition/sprite renderer thing is not a good solution. you have to put the object 100% exactly to not have gaps. better solution would be make a PREFAB BRUSH of the room transition object. just my opinion :-P

    • @FortbloxNET
      @FortbloxNET 5 лет назад

      ...and. when startin in the house the player looks down. it should look up. so after transition you need to change the sprite to look up :-)

    • @MisterTaftCreates
      @MisterTaftCreates  5 лет назад

      You're right. I think I address this in a future video by setting the last move x and y then calling update animation and move from the start method.

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

    I have error