I hope this series is helpful. You can support the making of this series and get access to the Complete Project Files of it (along with other cool rewards) by becoming a Patron: www.patreon.com/gamedevexperiments
For those who are following along: At 4:20 he scales the background and leaves space in the canvas for the dialogue box. For the canvas size to match what's used in the tutorial (due to canvas scale being based on scale with screen size), the game window must be set to a size of "Standalone (1024x768)" (is what he shows at start of video)
Thank you for this comment. I noticed the discrepancy and was searching for what setting to change to make them line up properly, but you answered that question before I spent too long on hunting around.
When you go to set the "standalone" if it doesn't pop up for you like it wouldn't for me, just create it, set those parameters and if the background shows up blue (mine did) go to battle camera and set the background color to black!
I just want to say, this series is exactly what I was looking for. Thank you so much for putting the time and effort into making this series, and sharing your knowledge in a very straightforward way.
After watching 7 episodes of the serie, I want to say THANK YOU. I actualy learned more from you in 2 hours than I did with the official unity tutorial in 10. Cheers!
For those who are following the tutorial, to be able to execute SetUp and SetData for the player and enemy units and HUD (in the BattleSystem script), be careful about something : When trying to set things up, Unity will look for the different stats that you put in the different fields of the Pokemon Object (Att-Def-SpAtt...) to initialize the Pokemon and Put some of the values in the HUD. WHEN YOU ADD A POKEMON as a scriptable object, make sure that you have the number 0 in the "Size" field of Learnable Moves. If you put something else than 0 and nothing in the elements for which you got some size, the game will try to look for things that you didn't implement yet, which would lead to the HUD not loading. Be careful about that ;)
i think this is my issue, im trying to figure out what you mean by keep 0 in the size, i tried it and it deleted the moves. if you can respond quick i would realllly appreciate that..
i'm going to leave a comment just to help your algorithm. i've been adapting your tutorials to my own rpg, and it's been a massive help. of course, my project is going to involve multiple enemies and "players", so i'm going to have to adapt it myself. i really, really appreciate you doing this!
For the anchor of everything, i think you should set it to match exactly to 4 corners of the image/panel/etc. It will scale just right when the game is set to different resolution.
Instant sub. Thank you so much for the tuts, great stuff man! All the other ones concerning a Pokemon type gameplay or just turn-based battle systems in general are mostly bloated or outdated. Thank you for keeping it straight and to the point.
Thank for the kind words. I believe it's really important to use good practices when making a big game like an RPG. Otherwise, things will get messy as the project grows.
I can't thank you enough for this tutorial series, it is so easy to follow and that you gave us the art assets for free and so well organized is a huge help. this is my first ever game project and the furthest I've ever made it through a tutorial series, because of your excellent teaching ability and kindness in sharing this material. THANK YOU!!!
Highly recommend looking at using a UI Slider for the HP Bar instead of multiple elements layered as unity bakes in a lot of useful references into the slider that consolidate the code.
@@GameDevExperiments do you know how youd do that? im following along :) but im not quite sure how to make my HPbar slider object slide based on my CurrentHP/MaxHP
Now that I look at this course again after a year, I realize everything I learned thanks to you. It's a shame that everything wasn't well planned from the beginning and that sometimes you left errors for the next video. That's the only bad thing I can say about this series. Well, that and it's not over yet, I hope to see the end of the course one day...
Hi there! Loving the tutorial! I have a question: I am currently at 21:20 setting the nameText and levelText to the c# script in the player hud, but when I drag the text to the script it's not letting me. I was able to add the HPBar to the script though. I checked the code and went back to see if I did something wrong with the text itself, but everything seems alright.
@@paulrobinson7843 The problem is probably that u copied his code, using 'Text nameText' and 'Text levelText', however, you are most likely using a newer version of unity that uses TextMeshPro instead of text, therefore, u should change 'Text' in the code to 'TextMeshProUGUI' and add 'using TMPro;' under the 'using UnityEngine.UI;' Hope this helps!
For those with Setup() and SetupBattle() errors (object reference missing).. I just fixed the issue after hours. First tip, check that casing (capitals/lowers) are in the right places on the BattleSystem script. Second tip, after assigning BattleSystem script to BattleSystem object, make sure to attach the objects. Do the same with the HUD Script and the HUD game object. Do the same with the BattleUnit script on the BattleUnit game object. Personally thinking that when trying to fix the issue a few of the object references on the game object were erased, so be sure to add them back in otherwise you'll be running in circles as Unity only directs you to the code and not what game object required the missing reference.
im able to move over my hpbar after creating the script but i cant add NameText or Lvl Text to the battle hud componant the options are there but unable to drop them into the box. any ideas?
@@Retro-player-u1p Did you use TextMeshPro instead of text? If so you need to change the Object type in your class to TextMeshProUGUI. If you can't drop something in it's likely the wrong type, there's a mismatch.
Love your tutorials so far! (still got some catching up to do). Wanted to ask, why did you choose to do the battle canvas in the same scene as the overworld? Was it to save the scene state as is, or to reduce loading time between scenes? Also, is a similar tactic used in the pre-3D games?
If it was in a different scene, we would have to save all the states in the overworld before switching to the battle scene, and then restore everything when switching back to it. So I kept it in the same scene to avoid that. I believe this can also be done for 3D. Instead of canvas you'll have a gameobject of the Battle Arena. When the battle starts we just have to enable the gameobject and switch the camera just like we do here.
@@GameDevExperiments Good point! I searched a bit online, but it's quite a hassle to pull off in Unity. A simple overlay with switching controls might be easier. How will you implement it when switching scenes (routes)? Make the whole Canvas a prefab, and add DontDestroyOnLoad to the GameManager & BattleSystem?
Good tutorial however I would keep them shorter and give us something to test more often. It wasn't until all the way at the end i realized I messed up something and it didn't work so I had to go all the way through the video again versus you having us test more often and us knowing whether we are doing it right or wrong. Thanks bro
Hello I'm having ratio issues with the battle camera and the background sprite. From what I see your battle camera is much more squarish and mine is much more rectangular and I cant resize the rectangle to make it smaller. I have pretty much the same settings for the battle camera, and battle canvas.
@@frozvial237 From the resolution drop down in the "Game" tab click the + icon to create a new resolution. Change the type from Fixed Resolution to Aspect Ratio and put in X=4, Y=3 for a 4:3 ratio. Set the label to whatever you want (eg "4:3") and save it.
Thanks so much for what you're doing here, btw. I'm learning so much from you and have had several comments from my coder friends on how impressed they were with the good practices I'm using and how clean my code is... owe a big thanks to you for that! You're helping people level up as coders and I think that's awesome!! I'm using your examples to fill out functions in my own game! So exciting!! I'm having an issue tho, I can't seem to find help with. In the BattleUnit Script I have 'using UnityEngine.UI;' but when I call the 'GetComponent().sprite = ' unity tells me that "Image is an ambiguous reference" and wont compile.. I've tried a few different fixes for this on google but applying it to our current context isnt going well.. any suggestions??
@@GameDevExperiments just UnityEngine.UI.. *edit* Actually after reviewing my script.. UnityEngine.UI is in the script but its greyed out like its not being used... maybe the Image = UnityEngine.UI.Image took over control?
Awesome tutorials, I'm learning a lot of new things about Unity and how to better organize my projects. I've got a question about the Battle Camera - why did you end up making another camera for this? Why not just make the Canvas and show / hide it when a battle starts? Is there a benefit to doing it this way, or something down the road that you are planning on using the camera for? Not exactly related, but I'm looking at doing camera pans when an attack animation is played to make the attacks have a cinematic type effect, but still new to using Canvas and UI, so that will be a little further down the road once i have the base implemented.
Hi Ben, Thanks for the feedback. The reason why I chose a separate canvas is because our main canvas is going to have lot's of other elements like menu, party screen, dialogbox, etc. So I thought separating it would be better.
@@GameDevExperiments Is the extra camera necessary? I've done it without the camera, and you should be able to show / hide whichever canvas you want active at the time. Having two cameras is where my confusion is :)
@@Distortion3933 i would actually go one step further and make the battle its own scene. Separate it entirely from the main scene so u don't have highly coupled objects. Battle scene has its own camera and canvases
I would have quick question I'm trying to animate the pokemons in battle. For that I have gifs Problem, Unity doesn't support gifs. So I have to either convert the gif to mp4 or to slice the gif in a series of images and then play them. but that's not something that can be done by hand since there's 3000+ gifs total (all the pokemons, and their forms, 4 times (back, front, shiny back, shiny front)) sooooooo if someone knows what to do I'm listening to all the propositions (great series btw, I'm around the 60th episode, and that's actually a really good one)
@@GameDevExperiments The gifs list I have is complete for all the pokedex in front/back with shiny forms so finding one similar sounds really impossible. What I plan to do is to convert those gifs into webm so it'll be accepted by unity. Just have to find a method that allows a big amount of convertion at once
I hope you are still answering comments. Your videos are great by the way. Keep them going! I'm really enjoying them! I was hoping you could teach us how Pokemon made sprites appear 3D when moving the player and camera. The trees, street signs, houses - all appears to change when you move around and appear 3D and the rest of the game appears 2D. How is this effect done? It was first implemented in Diamond and Pearl.
4:35 || please help your camera's orientation is square but mine is horizontal so , you extra space is in the bottom but my extra space is in the right ---- How To Solve This Problem ----
Hi, awesome video as the rest of the serie. Unfortunately i got a problem, My battle scene has different proportions than yours so the text under it doesn't fit, how do I change proportions? Is it correct to change Viewport Rect's W of BattleCamera to something like 0.6?
Is there a specific reason you use the Screen Space render mode instead of World Space? I'm making a different battle system but I'm taking some tips and tricks from your tutorials and I've already set up most of my UI in a camera that was already World Space and if I try to change back to Screen space there are lots of annoying scaling and positioning errors due to having made it in the other one so I don't really want to change it if it's not a big deal.
I guess it's okay to do it worldspace since the battle camera doesn't move. I set it screenspace because then, everything will be relative to the camera.
I'm having an issue where the front sprite of all but bulbasaur is coming up larger than needed. looking at it all the back sprites and the front bulb are set to 64x64, but the other are their own dimensions, as well as (NPOT). any ideas on how to fix?
loving the series so far but im having a problem towards the end of this video. when i try to drag the player unit into the player unit part of the script in the inspector it doesnt work the only thing i can drag there is the player hud
Hey man ! Nice video ! I have a question, for "BattleUnit" I've an error for "GetComponent... pokemon.Base.BackSprite;" and the same for FrontSprite;" how can I correct that please ? The console said to me "PokemonBase" don't have definition for"BackSprite" and "FrontSprite". I don't understand ^^'
Hi, great series and its helping me a ton with my own game im making that will have a similar battle system, but i have a big question. how do i get the pokemon that are created in inspector to be animated? right now you have a script that allows front and back sprites to be added which is great for the oldschool pokemon before they were animated, but what about for animated pokemon? How do you get them to animate on the battlefield? Also to be clear im not talking about simply moving the sprites position, i mean full keyframe animation of the sprite from a sprite sheet.
This is just how I’d do it, but I’m fairly new to this so there may he a better way. What I would do is instead of having frontsprite and backsprite as literal sprites, make them gameobjects. Then create a gameobject for ,say, bulbasaur’s frontsprite, code its animation there using mechanim and a script, then drag that gameobject into your frontsprite part in the inspector. I’d take the same approach with 3d models, too
im able to move over my hpbar after creating the script but i cant add NameText or Lvl Text to the battle hud componant the options are there but unable to drop them into the box. any ideas?
this seemed helpfull a year later when i had to do a school project and i decided to do a game like the prodigy math game where its like pokemon but to hit you had to do math equasions thanks for the second camera idead btw
I downloaded some Pokémon sprites but they are different sizes. The default image that changes with the different Pokémon fits the image to the size of the default. Is there any way to make the default sprite change with the sprite that is active?
You can also make it in a separate scene. But then you'll have to save all the states in the current scene before switching to the battle scene. I didn't go with the different scene approach to avoid that complication.
Hey, thank you for the tutorial! when creating the text i cant create text i only have "textmeshpro" wich kinda worked for me until the very end, when the text wont load. i suppose its because of that diffrence. Can you explain me why i dont see the option to create UI->text or maybe how to make it work with textmeshpro?
i solved it. i had the Z position of my Dialoge not at 0 wich led it to be "behind" the camera. put it all to 0 and then the Text appeared in the game mode
Hey I got a NullReferenceException at every part of the code where I call Pokemon.Base.something And I cant debug.log inside where unity expects a get apparently. I think it might be because Pokemon.Base is an instance not set to an object? But I have the Charmander SO put onto PlayerUnit :/ Any ideas where I should look to debug? Edit: Nvm I found the issue. I had missed Pokemon = new Pokemon(Base, level);. Without that Pokemon was an instance floating in space. Great videos btw. I had kinda reached the peak of brackeys level tutorials and needed the next level up.
I think I'm having the same problem, do you mind elaborating where were you missing this? Pokemon = new Pokemon(Base, level);. EDIT: Nevermind, found the issue. I named my files differently but OP's comment still applies, here's what I changed. prnt.sc/zxsbil
NullReferenceException: Object reference not set to an instance of an object BattleSystem.SetupBattle () (at Assets/Scripts/Battle/BattleSystem.cs:18) BattleSystem.Start () (at Assets/Scripts/Battle/BattleSystem.cs:12) it didnt load the data of the pokemon, can someone help?
Hi ! First of all, thank you for this series of tutorials, it is insanely well explained and structured. I have one question about your main camera setting : How did you get it to get almost a squared one like in a pokemon game ( What i mean is that your default camera is already sized like in a Pokemon game and not mine, and i want to be able to change that) Because mine is a very long rectangle and i want to resize it to avoid having to loose the aspect ratio of the battle system background when i create the canvas. Thanks a lot in advance, and keep on the great work man !
Hey thanks a lot for the feedback. You can change the camera's aspect ratio from the Game tab. By default it will be Free Aspect, change it to Standalone.
You can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it slightly in part 13. There are also other tutorials for it on youtube.
Anyone else not being able to put their pokemon into the Base of the Battle Unit Script? I keep getting "Type cannot be found: PokemonBase. Containing file and class name must match." Edit: Restarted Unity and recreated all the pokemon, it's working now.
Hi! loving following these tutorials, signed up to your patreon but I cannot find the battle backgrounds in the files ? can you point me to them please.
What camera dimensions are you using? I started with default camera setup, but seems to have messed me up for this video. Mine is a less tall, wider rectangle and orthogonal projection.
Hello @Game Dev Experiments , Love the tutorials. I was wondering about your text you imported, i tried to include the image and the meta file and it won't recognize it. I see alot of people using text mesh, was wondering how you set yours up. Thanks for any and all help!
You might have made some mistake in the code. You can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it in this video. ruclips.net/video/al2LjGRRcu8/видео.html
Ive been using Text Mesh Pro instead of normal Text, and while Ive been able to follow along wherever you've used Text, without getting errors, I simply cant get it to update the Pokemon's name and level after setting them in the inspector. Am I missing something to get it to work, or should I just switch to normal Text?
20.25 what you were doing did not work for me. I have to add " Monster Stats; " to call the Monster class like that for me to have access to the Property. Unno if its cause im using a newer unity version or maybe its how c# has been updated. DOnt know but anyone else who cant get the property to show I suggest calling the class
Awesome tutorial man, this is really helping me a lot! Not sure if you'lI end up seeing this or not but I'd like to ask something: I was having an issue with the setup battle method in that unity was flagging up that there was no reference set for 'Pokemon' in 'BattleUnit' (playerHud.SetData(playerUnit.Pokemon), this was not the case and I checked through the code many many times and I couldn't see an issue with it. And then without me doing anything or changing anything about the code it just started working which left me feeling really confused. So my question is, does this happen to you at all? and is it common for the software to make a mistake like this?
@@GameDevExperiments Yeah I've actually figured out what my issue is now, it seems I have a slight bug with Unity in that it doesn't compile all the scripts when closing or minimising visual studio, only the one I was last editing. To fix it i basically have to go through every one of my scripts and save and minimise them one at a time, which is abit annoying Keep it up man, I've learned so much from you in only a few videos! I'd love to see you run through other kinds of games too, roguelikes are a genre I'd love to see in action.
Very good tutorial. My only issue is that charmanders sprite leaves the battle backgrounds bottom border and overlaps the black border of the dialog box as charmander is slightly bigger than bulbasaur on the sprite. Did i miss something?
can you help me man? i think we're creating the same game and I wanna create a random question type, it's for my thesis project :3. I just wanna know some tips to finish it early before december :(
Hey man, I've been enjoying the videos so far, but I can't get past this one. I've got the scripts copied word for word, allocated them to the proper elements and watched this video over and over to make sure I'm not missing anything, but the sprites and HUD elements just don't change when I run the game. The only difference I can see between what I'm doing and the video is when I rewrite pokemon to be upper case in the battle unit script, it doesn't change in Battle System at the same time. Not sure where I'm going wrong or if it's something up with Visual Studio/Unity?
You can add breakpoints in visual studio and debug to find out what's going wrong. I've touched debugging in part 13 and In the next 3-4 days I'll release an entire video on debugging and fixing issues.
I don’t know if you are still commenting or if some one can help it won’t show the moves on the battle screen just shows the line where the 4th move should be
I'm not sure what the issue is. You can add breakpoints and try debugging in visual studio to understand what's going wrong. If you're not familiar with debugging, I've covered it slightly in part 13.
Hello there. Im having a great time with your series but there's this weird error popping up. whats the meaning of this error? MonoScriptImporterInspector.OnEnable must call base.OnEnable to avoid unexpected behaviour. UnityEditor.Tilemaps.GridPaintPaletteClipboard:OnDisable () (at Library/PackageCache/com.unity.2d.tilemap@1.0.0/Editor/GridPaintPaletteClipboard.cs:347) how can i solve this?
@@GameDevExperiments thank you for the reply, someone on your discord suggested the same thing so I tried it and it worked and with animations. Also I’m a Patreon supporter and I didn’t see a tutorial for the ability system but I found the files for it that you provided. I’m following your videos because it’s teaching me a lot but after which video would you recommend inserting that code?
@@shadowartz9968 Thanks for the support! Try to read & understand the code for the abilities before adding that to your project. I recommend starting abilities once you watch the first 50 videos in the series.
I'm having an issue at the end of the video where we test to make sure everything works. the enemy pokemon just comes out as a white box. after about an hour of messing with stuff i used the provided files from your patreon page and it still wont work. not sure where it went wrong.
16:31 || Bro my health Bar(green) just disappears(it doesn't show half health) It is also constantly giving this message in the console "There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene."
@@GameDevExperiments By disabling the battle game object the error was gone but the (by the way thanks for your response but) The real problem was that the hp bar was not showing and it isn't showing now also (In fact the whole battle system disappeared)
@@cardiacorca3176 That's weird. You don't see any other errors in the console right? can you try debugging in visual studio to figure out what's going wrong?
@@cardiacorca3176 If you haven't done debugging before, I've covered it slightly in part 13. Basically you can add breakpoints and try to understand how the code is working. In part 13, I used debugging to demonstrate how the code is working.
this method isnt really working for me. I get an error saying i must use a scriptable object. Im using Unity 2022 would that make this kind of difference
I get an error when in my BattleSystem script about the SetData. It says: "NotImplementedException: The method or operation is not implemented. BattleSystem.SetupBattle () (at Assets/Scripts/Battle/BattleSystem.cs:21)" Please help, I have no idea what I did wrong. I've followed your tutorial but I've very little experience with coding. I'm just completely stumped.
@@GameDevExperiments I deleted the scripts and tried again. It seems like I must have misspelled SetData at some point. It's fixed now. Lesson learned =D
In the script for Battle Unity, they say "For testing the system, we'll set these values in inspector, but later on we'll set these dynamically when we start a battle". Can someone point me to which video they change this code later on? Much appreciated.
amazing work! i have a small problem right now and it´s that the front and back sprites are not recognized in the coding, and i don´t know what´s wrong...
@@enthusigasmofficial5892 i found my issue, it was that the SetData part in BattleSystem was a private class and not public class. though im vary sad right know because all of the world build i did was gone lost and i need to rebuild it again.... though all of the code and sprites are still there :)
What was the reasoning behind making BattleUnit instead of having the BattleUnit logic in Pokemon? Was it because you wanted the BattleSystem to not have the Pokemon class in it as a SerializableField? Or was it because that's the only place that you could define specifics about a specific Pokemon (such as what level this particular pokemon is) without putting it in the BattleSystem or making Pokemon objects for Charmander lvl1, Charmander lvl2, etc? Been enjoying the series but wanted to understand at a high level what the thought process you had of structuring your solution this way was. Thanks.
Right now I'm setting the pokemon and level of the battle unit from the inspector. This is just to make testing battle system easy. In the future videos, I'll set that dynamically when the battle starts. Pokemon class will be used in many other scripts, for example, the map script will have the list of pokemons in that area, trainers will also have a list of pokemons etc. so making it a plain class made sense.
I cannot fix this error. Can ya help me fix it? Thanks. NullReferenceException: Object reference not set to an instance of an object BattleUnit.Setup () (at Assets/Scripts/BattleUnit.cs:20) BattleSystem.SetupBattle () (at Assets/Scripts/BattleSystem.cs:19) BattleSystem.Start () (at Assets/Scripts/BattleSystem.cs:14)
Looks like some object in line 20 of the BattleUnit script is null. You can try adding breakpoint in that line and check what's happening. I've made a video that explains how to fix null reference errors ruclips.net/video/al2LjGRRcu8/видео.html
23:46 it is giving me an error " Cannot implicitly convert type 'string' to 'UnityEngine.Sprite' ". Pls help me in solving d error. Btw I love ur vids. Very Well Explained
@@GameDevExperiments Oh thanks a lot man! (That was actually a really bad question from my side xD ). Im surely gonna recommend ur channel to others too :-)
Hi I just need to ask one thing. When my battle camera is activated and I try to see the game screen then there's a black screen and on the left bottom my battle canvas is visible. Battle Camera has the same size as the Battle Canvas, i have checked it twice. So, any idea why's this happening.
when writing the battleunit code I keep getting a cs0246 error saying that the type or namespace name of pokemon could not be found, I understand that it should be identical to the name of the constructor in the pokemon script. But even when I change it seemingly won't recognize that I am putting in the same name. I have tried copypasting directly from the other file so Its not that I am typing it wrong. I am just not sure what it could be, I thought it might because the file and method have the same name. But any help would be appreciated.
Nevermind I figured it out, but for anyone that was curious I had left the void in the constructor accidently from a previous video and it gave me an error when I tried to because the name of the class and the constructor were slightly off because of an accidental capilization. after fixing the spelling and removing the void it starting communicating with the other file.
For a 3D game, would you recommand to teleport the player to one side of the map with an other camera, UI and all, or loading a different scene ? Though, is it possible to save your position before battle and return there when it has ended Great series by the way
Hey I got a weird problem with the health bar, as soon as I start the game the green image is invisible, I checked the inspector and saw as I press play the image scale get changed to 0 on the Z axis. I tried to put 10 as default, but when I press play it always gets changed to 0?
When I change the script on 16:10 to new Vector3(0.5f, 1f, 1f) it works and the Z axis stays at 0, but why did it get changed to 0 by default in my game but you seem to be fine with just declaring x and y?
You're having a problem with basically every video. Maybe try to find a solution before asking a vague question then saying "oh nvm I just did x" every time. Just comes across as lazy/you being in over your head.
I love the Series! Since im very new i learn a buttton of things to use. But i got one question ... instead of a Sprite for back and front i want the program to grab a 3d Object. i tried to simply replace the part with Mesh instead of Image (i also did this in the initial refrence) but i cant grab it with the "GetComponent" ... I spent the whole day banging my head against the wall on this today ... maybe im just stupid and its really easy but ... as i said im new ^^'
Thanks for the feedback! If you want it to be 3d, In the pokemon class, instead of having a sprite for front and back, you should have a reference to a gameobject. To this field, you can attach a prefab that contains the model of the pokemon and finally, you can instantiate this prefab when the battle starts. So you'll have to create a prefab for each pokemon.
@@GameDevExperiments I have tha same problem... i understand what you are saying, but somehow i can not manage to do it. Can you explain in more detailed? I copied all of your scripts, the only difference is that in the "pokemonbase" scripatble object script i used [SeriealizeField] GameObject enemyobject instead of sprites. I would be greatful if you could help me with screenshots or something like that.
I seem to be having some slight issues regarding this. When I try to test the game, nothing seems to change. The player's sprite doesn't change to Charmander, the names and levels of the pokemon don't appear either. There doesn't seem to be wrong with the scripts. It's just that they don't seem to be doing anything. Can anyone give me any advice to rectify this?
Hey, i can't get why, when i launch the game my Charmander Name Lvl and Sprite are displayed right but the HP bar is always empty, i've got this problem since i add the BattleSystem Script in the game, before that the HP bar was full, hope you can help me because i already watched your debugging video and i can't get it to work, (sorry for poor english, isn't my primary language) Here my BattleSystem Script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class BattleSystem : MonoBehaviour { [SerializeField] BattleUnit playerUnit; [SerializeField] BattleHud playerHud; private void Start() { SetupBattle(); } public void SetupBattle() { playerUnit.Setup(); playerHud.SetData(playerUnit.Pokemon); } } Have a nice day :)
This series is super helpful! But, I’m getting an error in the BattleUnit script. It says that PokemonBase doesn’t have a definition for BackSprite or FrontSprite. I’ve copied all the scripts as best I can but I must have missed something. Do you know what it could be?
Looks like you didn't create the property for BackSprite and FrontSprite. If you've created then make check if the letter case is correct. That is, it should be BackSprite instead of backSprite.
@@GameDevExperiments i have same problem too. it appear PokemonBase doesn’t have a definition for BackSprite or FrontSprite. I try again and again still error. How to solve it eh?
You can add breakpoints and try debugging in visual studio to understand what's causing the error. If you're not familiar with debugging, I've covered it in this video. ruclips.net/video/al2LjGRRcu8/видео.html
@@GameDevExperiments hi again im still stuck in this part but i saw that the the input of the hp and level are 0 and moves and base are null Pokemon: Base: null Level:0 HP:0 Moves: null i think the problem is somewhere here; HP = MaxHp; Base = pBase; Level = pLevel; Moves = new List();
Do you see any errors in the console? Btw ou can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it slightly in part 13. There are also other tutorials for it on youtube.
I had the same problem and then i realized the issue was i typed the code as enemyHud.SetData(playerUnit.Pokemon); instead of enemyHud.SetData(enemyUnit.Pokemon);
Hi, I'm facing a problem and that's when I enter the play mode , the HP bar becomes invisible and I don't know what's causing the problem. using System.Collections; using System.Collections.Generic; using UnityEngine; public class HPBar : MonoBehaviour { [SerializeField] GameObject health; public void SetHP(float hpNormalized) { health.transform.localScale = new Vector3(hpNormalized, 1f); } } Is there anything I missed or messed up.
@Blender World Just add Debug.Log(hpNormalized); at the start of the SetHP function. BTW If you're new to C#, I recommend spending few days learning the basics. Once you know the basics, it will be easy to follow along this series.
@@GameDevExperiments Thanks for this but still the health bar is not visible though I can see the change in health in console. One more thing, the value is not set to 0.
Is there a way I can use 3d models and still follow this tutorial? (I used an GameObject in my script instead of sprite front and sprite back)...I'm extremely new to coding
@@GameDevExperiments Thank you so much for replying but how do I use a Gameobject instead of a sprite in the Setup? I'm sorry if I am a bother but if you wouldn't mind helping me with that line? When I release my game I'll give you full credit
I hope this series is helpful. You can support the making of this series and get access to the Complete Project Files of it (along with other cool rewards) by becoming a Patron: www.patreon.com/gamedevexperiments
@yash sahare I didn't understand the problem clearly
My Camera has width and height does not similar this video. Can someone help me fix it pls?
My camera display as Rectangle but this video as Square
For those who are following along: At 4:20 he scales the background and leaves space in the canvas for the dialogue box. For the canvas size to match what's used in the tutorial (due to canvas scale being based on scale with screen size), the game window must be set to a size of "Standalone (1024x768)" (is what he shows at start of video)
Thank you for this comment. I noticed the discrepancy and was searching for what setting to change to make them line up properly, but you answered that question before I spent too long on hunting around.
Good job - need more people like you helping the community.
You are the best, thank you so much.
i love you
When you go to set the "standalone" if it doesn't pop up for you like it wouldn't for me, just create it, set those parameters and if the background shows up blue (mine did) go to battle camera and set the background color to black!
I just want to say, this series is exactly what I was looking for. Thank you so much for putting the time and effort into making this series, and sharing your knowledge in a very straightforward way.
Thanks a lot. Feedback like these makes the effort put into making the series totally worth it.
After watching 7 episodes of the serie, I want to say THANK YOU. I actualy learned more from you in 2 hours than I did with the official unity tutorial in 10. Cheers!
Not Unity Related but being able to rename your variables in one go like at 19:30 is really helpful to know in Visual Stuidos.
True, it will save us a lot of work!
For those who are following the tutorial, to be able to execute SetUp and SetData for the player and enemy units and HUD (in the BattleSystem script), be careful about something : When trying to set things up, Unity will look for the different stats that you put in the different fields of the Pokemon Object (Att-Def-SpAtt...) to initialize the Pokemon and Put some of the values in the HUD. WHEN YOU ADD A POKEMON as a scriptable object, make sure that you have the number 0 in the "Size" field of Learnable Moves. If you put something else than 0 and nothing in the elements for which you got some size, the game will try to look for things that you didn't implement yet, which would lead to the HUD not loading. Be careful about that ;)
i think this is my issue, im trying to figure out what you mean by keep 0 in the size, i tried it and it deleted the moves. if you can respond quick i would realllly appreciate that..
Thank you. That was driving me crazy
i'm going to leave a comment just to help your algorithm. i've been adapting your tutorials to my own rpg, and it's been a massive help. of course, my project is going to involve multiple enemies and "players", so i'm going to have to adapt it myself.
i really, really appreciate you doing this!
Thanks a lot for the support. It means a lot to me :)
For the anchor of everything, i think you should set it to match exactly to 4 corners of the image/panel/etc. It will scale just right when the game is set to different resolution.
Instant sub. Thank you so much for the tuts, great stuff man! All the other ones concerning a Pokemon type gameplay or just turn-based battle systems in general are mostly bloated or outdated. Thank you for keeping it straight and to the point.
Thanks a lot man! For someone who just started making tutorials, feedback like these are really motivating.
It’s one of the best tutorials about this subject for Good Coding practice. cheers
Thank for the kind words. I believe it's really important to use good practices when making a big game like an RPG. Otherwise, things will get messy as the project grows.
I can't thank you enough for this tutorial series, it is so easy to follow and that you gave us the art assets for free and so well organized is a huge help. this is my first ever game project and the furthest I've ever made it through a tutorial series, because of your excellent teaching ability and kindness in sharing this material. THANK YOU!!!
Thanks a lot for the feedback. Reading this made my day. Btw the art assets are not mine. It's a copyright free asset that I found from opengameart.
You deserve more subs. So far seems helpful.
Thanks a lot for the Feedback, they do motivate me :)
Started these tutorials yesterday, instant sub, very clear and you do them really well ! Keep going mate !
Thanks mate. I'm glad you like it :)
Highly recommend looking at using a UI Slider for the HP Bar instead of multiple elements layered as unity bakes in a lot of useful references into the slider that consolidate the code.
Thanks, that's a good point!
@@GameDevExperiments do you know how youd do that? im following along :) but im not quite sure how to make my HPbar slider object slide based on my CurrentHP/MaxHP
@@noahhkun5097 I haven't used it anytime soon. Try reading the unity docs for slider, there is some function to set the slider values.
Now that I look at this course again after a year, I realize everything I learned thanks to you. It's a shame that everything wasn't well planned from the beginning and that sometimes you left errors for the next video. That's the only bad thing I can say about this series. Well, that and it's not over yet, I hope to see the end of the course one day...
Thanks. I'm so happy to hear you learned so much from the series :)
This looks fantastic, thank you for doing this! I'm so excited to start working through your tutorials this weekend.
Hi Henry, thanks for the feedback. I hope you'll enjoy working through it.
Thank you for giving us so much knowledge. I really want you to have all the support you deserve. I'll make sure to become a patreon in a few days.
Thank you so much :)
Love these tutorials! You're great at explaining things! Keep them coming!
Thanks a lot Justin. I'm glad you like it :)
Perfect! Your work is excellent!
Thanks, I'm glad you think so :)
I am speechless!!! THANK YOU!!! This is amazing.
Thanks a lot. I'm so happy to hear that :)
Hi there! Loving the tutorial! I have a question:
I am currently at 21:20 setting the nameText and levelText to the c# script in the player hud, but when I drag the text to the script it's not letting me. I was able to add the HPBar to the script though. I checked the code and went back to see if I did something wrong with the text itself, but everything seems alright.
did you find a solution to this ?
@@paulrobinson7843 The problem is probably that u copied his code, using 'Text nameText' and 'Text levelText', however, you are most likely using a newer version of unity that uses TextMeshPro instead of text, therefore, u should change 'Text' in the code to 'TextMeshProUGUI' and add 'using TMPro;' under the 'using UnityEngine.UI;'
Hope this helps!
These videos are amazing, thank you for teaching me so much!!
Thanks, I'm happy to hear the series is helping :)
For those with Setup() and SetupBattle() errors (object reference missing).. I just fixed the issue after hours. First tip, check that casing (capitals/lowers) are in the right places on the BattleSystem script. Second tip, after assigning BattleSystem script to BattleSystem object, make sure to attach the objects. Do the same with the HUD Script and the HUD game object. Do the same with the BattleUnit script on the BattleUnit game object. Personally thinking that when trying to fix the issue a few of the object references on the game object were erased, so be sure to add them back in otherwise you'll be running in circles as Unity only directs you to the code and not what game object required the missing reference.
im able to move over my hpbar after creating the script but i cant add NameText or Lvl Text to the battle hud componant the options are there but unable to drop them into the box. any ideas?
@@Retro-player-u1p Did you use TextMeshPro instead of text? If so you need to change the Object type in your class to TextMeshProUGUI. If you can't drop something in it's likely the wrong type, there's a mismatch.
So much in depth 🤣 on the way learning c# too thank you
I'm thrilled to hear that :)
Ik I'm very early in the series but I got to let you know that you are amazing 👏
Thanks a lot for the feedback :)
This tutorial has been soooo helpful!!
This series is Incredible thank you!
Thanks a lot, I'm glad to hear that.
Love your tutorials so far! (still got some catching up to do). Wanted to ask, why did you choose to do the battle canvas in the same scene as the overworld? Was it to save the scene state as is, or to reduce loading time between scenes? Also, is a similar tactic used in the pre-3D games?
If it was in a different scene, we would have to save all the states in the overworld before switching to the battle scene, and then restore everything when switching back to it. So I kept it in the same scene to avoid that.
I believe this can also be done for 3D. Instead of canvas you'll have a gameobject of the Battle Arena. When the battle starts we just have to enable the gameobject and switch the camera just like we do here.
@@GameDevExperiments Good point! I searched a bit online, but it's quite a hassle to pull off in Unity. A simple overlay with switching controls might be easier. How will you implement it when switching scenes (routes)? Make the whole Canvas a prefab, and add DontDestroyOnLoad to the GameManager & BattleSystem?
@@bluezamx814 Yeah, I would add DontDestroyOnLoad for BattleSystem and GameController.
Good tutorial however I would keep them shorter and give us something to test more often. It wasn't until all the way at the end i realized I messed up something and it didn't work so I had to go all the way through the video again versus you having us test more often and us knowing whether we are doing it right or wrong.
Thanks bro
Thanks for the feedback. I've tried to improve that in the later videos.
Hello I'm having ratio issues with the battle camera and the background sprite. From what I see your battle camera is much more squarish and mine is much more rectangular and I cant resize the rectangle to make it smaller. I have pretty much the same settings for the battle camera, and battle canvas.
In the game tab, make sure to change the screen size from "Free Aspect" to "Standalone"
@@GameDevExperiments Standalone?
@@frozvial237 From the resolution drop down in the "Game" tab click the + icon to create a new resolution. Change the type from Fixed Resolution to Aspect Ratio and put in X=4, Y=3 for a 4:3 ratio. Set the label to whatever you want (eg "4:3") and save it.
@@pancake8133 Worked for me, thank you !
Thanks so much for what you're doing here, btw. I'm learning so much from you and have had several comments from my coder friends on how impressed they were with the good practices I'm using and how clean my code is... owe a big thanks to you for that! You're helping people level up as coders and I think that's awesome!! I'm using your examples to fill out functions in my own game! So exciting!!
I'm having an issue tho, I can't seem to find help with.
In the BattleUnit Script I have 'using UnityEngine.UI;'
but when I call the 'GetComponent().sprite = ' unity tells me that "Image is an ambiguous reference" and wont compile.. I've tried a few different fixes for this on google but applying it to our current context isnt going well..
any suggestions??
After like 4 hours I found it... i had to add
using Image = UnityEngine.UI.Image;
In case anyone else has this problem. Good luck Ladies and Gents!
Thanks for the feedback Matthew. glad you found the fix. Btw are you using any other namespace with the Image class? I'm wondering it's ambiguous.
@@GameDevExperiments just UnityEngine.UI..
*edit* Actually after reviewing my script.. UnityEngine.UI is in the script but its greyed out like its not being used... maybe the Image = UnityEngine.UI.Image took over control?
Awesome tutorials, I'm learning a lot of new things about Unity and how to better organize my projects. I've got a question about the Battle Camera - why did you end up making another camera for this? Why not just make the Canvas and show / hide it when a battle starts? Is there a benefit to doing it this way, or something down the road that you are planning on using the camera for?
Not exactly related, but I'm looking at doing camera pans when an attack animation is played to make the attacks have a cinematic type effect, but still new to using Canvas and UI, so that will be a little further down the road once i have the base implemented.
Hi Ben, Thanks for the feedback. The reason why I chose a separate canvas is because our main canvas is going to have lot's of other elements like menu, party screen, dialogbox, etc. So I thought separating it would be better.
@@GameDevExperiments Is the extra camera necessary? I've done it without the camera, and you should be able to show / hide whichever canvas you want active at the time. Having two cameras is where my confusion is :)
@@Distortion3933 i would actually go one step further and make the battle its own scene. Separate it entirely from the main scene so u don't have highly coupled objects. Battle scene has its own camera and canvases
I would have quick question
I'm trying to animate the pokemons in battle. For that I have gifs
Problem, Unity doesn't support gifs.
So I have to either convert the gif to mp4
or to slice the gif in a series of images and then play them.
but that's not something that can be done by hand since there's 3000+ gifs total
(all the pokemons, and their forms, 4 times (back, front, shiny back, shiny front))
sooooooo if someone knows what to do I'm listening to all the propositions
(great series btw, I'm around the 60th episode, and that's actually a really good one)
Thanks for the feedback! Btw you should able to find spritesheets with pokemon animations on the internet!
@@GameDevExperiments The gifs list I have is complete for all the pokedex in front/back with shiny forms so finding one similar sounds really impossible.
What I plan to do is to convert those gifs into webm so it'll be accepted by unity.
Just have to find a method that allows a big amount of convertion at once
@@loweffortsongs5380 Oh okay!
I hope you are still answering comments.
Your videos are great by the way. Keep them going! I'm really enjoying them!
I was hoping you could teach us how Pokemon made sprites appear 3D when moving the player and camera. The trees, street signs, houses - all appears to change when you move around and appear 3D and the rest of the game appears 2D.
How is this effect done? It was first implemented in Diamond and Pearl.
Great tutorial! I had some errors, but they were because you made mistakes.
so, you are copying. what a revelation
4:35 || please help your camera's orientation is square but mine is horizontal so , you extra space is in the bottom but my extra space is in the right
---- How To Solve This Problem ----
Had same problem. Under game tab, switch display 1 to 4:3
@@mbreed000 Thank You so much bro I can finally follow the tutorial completely(This is my second account)
Thank You Thank You So much!!
Hi, awesome video as the rest of the serie.
Unfortunately i got a problem,
My battle scene has different proportions than yours so the text under it doesn't fit, how do I change proportions?
Is it correct to change Viewport Rect's W of BattleCamera to something like 0.6?
Hello, in the game tab you need to change Free Aspect to Standalone (1024 x 768)
@@MiguelLopez-ty6ny Thanks, it worked
you should have more then 500 subs
Hi Faustas, thanks for the kind words. I hope this series was helpful for you.
Help! When I try to activate the fight, the names of the moves do not appear, but the '-' appears when it is empty.
Is there a specific reason you use the Screen Space render mode instead of World Space? I'm making a different battle system but I'm taking some tips and tricks from your tutorials and I've already set up most of my UI in a camera that was already World Space and if I try to change back to Screen space there are lots of annoying scaling and positioning errors due to having made it in the other one so I don't really want to change it if it's not a big deal.
I guess it's okay to do it worldspace since the battle camera doesn't move. I set it screenspace because then, everything will be relative to the camera.
I'm having an issue where the front sprite of all but bulbasaur is coming up larger than needed. looking at it all the back sprites and the front bulb are set to 64x64, but the other are their own dimensions, as well as (NPOT). any ideas on how to fix?
Is there any way to fill the values in the .asset file from a script?
loving the series so far but im having a problem towards the end of this video. when i try to drag the player unit into the player unit part of the script in the inspector it doesnt work the only thing i can drag there is the player hud
longshot but did you ever figure that out?
I cant attach the NameText in the Name Text function, only the Hp Bar works, why
me also any fix ?
Hey man ! Nice video ! I have a question, for "BattleUnit" I've an error for "GetComponent... pokemon.Base.BackSprite;" and the same for FrontSprite;" how can I correct that please ? The console said to me "PokemonBase" don't have definition for"BackSprite" and "FrontSprite". I don't understand ^^'
Hi, great series and its helping me a ton with my own game im making that will have a similar battle system, but i have a big question. how do i get the pokemon that are created in inspector to be animated? right now you have a script that allows front and back sprites to be added which is great for the oldschool pokemon before they were animated, but what about for animated pokemon? How do you get them to animate on the battlefield? Also to be clear im not talking about simply moving the sprites position, i mean full keyframe animation of the sprite from a sprite sheet.
This is just how I’d do it, but I’m fairly new to this so there may he a better way.
What I would do is instead of having frontsprite and backsprite as literal sprites, make them gameobjects. Then create a gameobject for ,say, bulbasaur’s frontsprite, code its animation there using mechanim and a script, then drag that gameobject into your frontsprite part in the inspector. I’d take the same approach with 3d models, too
im able to move over my hpbar after creating the script but i cant add NameText or Lvl Text to the battle hud componant the options are there but unable to drop them into the box. any ideas?
this seemed helpfull a year later when i had to do a school project and i decided to do a game like the prodigy math game where its like pokemon but to hit you had to do math equasions thanks for the second camera idead btw
I'm glad it's helping :)
the character is jerky when movin from left to right but not up and down when camera foll.\ is enabled
Great tutorial ! This series is just amazing. Thanks a lot
(be careful with the mouse noises tho ^^ too much of them in this one)
Thanks for the feedback!
Geez who cares about mouse clicks??
I downloaded some Pokémon sprites but they are different sizes. The default image that changes with the different Pokémon fits the image to the size of the default. Is there any way to make the default sprite change with the sprite that is active?
How come the battle scene is just a different camera rather than a different scene? Would a completely isolated scene not be cleaner?
You can also make it in a separate scene. But then you'll have to save all the states in the current scene before switching to the battle scene. I didn't go with the different scene approach to avoid that complication.
Hey, thank you for the tutorial! when creating the text i cant create text i only have "textmeshpro" wich kinda worked for me until the very end, when the text wont load. i suppose its because of that diffrence. Can you explain me why i dont see the option to create UI->text or maybe how to make it work with textmeshpro?
i solved it. i had the Z position of my Dialoge not at 0 wich led it to be "behind" the camera. put it all to 0 and then the Text appeared in the game mode
Hey I got a NullReferenceException at every part of the code where I call Pokemon.Base.something
And I cant debug.log inside where unity expects a get apparently. I think it might be because Pokemon.Base is an instance not set to an object? But I have the Charmander SO put onto PlayerUnit :/
Any ideas where I should look to debug?
Edit: Nvm I found the issue. I had missed Pokemon = new Pokemon(Base, level);. Without that Pokemon was an instance floating in space.
Great videos btw. I had kinda reached the peak of brackeys level tutorials and needed the next level up.
Thanks a lot, I'm happy to hear the series is helping :)
so glad I found your comment. I was about to bang my head on the wall. I can't believe I somehow missed when that line was added.
I think I'm having the same problem, do you mind elaborating where were you missing this? Pokemon = new Pokemon(Base, level);.
EDIT: Nevermind, found the issue. I named my files differently but OP's comment still applies, here's what I changed.
prnt.sc/zxsbil
@@aikou2886 Thank you ser, you saved my headache
How would you tweak the script to set the position of a 3d model instead of a front and backsprite?
NullReferenceException: Object reference not set to an instance of an object
BattleSystem.SetupBattle () (at Assets/Scripts/Battle/BattleSystem.cs:18)
BattleSystem.Start () (at Assets/Scripts/Battle/BattleSystem.cs:12)
it didnt load the data of the pokemon, can someone help?
Hi ! First of all, thank you for this series of tutorials, it is insanely well explained and structured.
I have one question about your main camera setting :
How did you get it to get almost a squared one like in a pokemon game ( What i mean is that your default camera is already sized like in a Pokemon game and not mine, and i want to be able to change that)
Because mine is a very long rectangle and i want to resize it to avoid having to loose the aspect ratio of the battle system background when i create the canvas.
Thanks a lot in advance, and keep on the great work man !
Hey thanks a lot for the feedback.
You can change the camera's aspect ratio from the Game tab. By default it will be Free Aspect, change it to Standalone.
@@GameDevExperiments Thanks a lot for the quick answer !!!
@@plazon8499 Happy to help :)
for some reason my hp bar isnt moving at all? I typed everything out the same idk whats wrong
You can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it slightly in part 13. There are also other tutorials for it on youtube.
Did you fix it, mate? I just started and got in the same trouble.
Anyone else not being able to put their pokemon into the Base of the Battle Unit Script? I keep getting "Type cannot be found: PokemonBase. Containing file and class name must match."
Edit: Restarted Unity and recreated all the pokemon, it's working now.
me too. and recreating the pokemon and restarting unity didn't help.
@@LAGinator429 sorry to hear that. Unfortunately I have no idea what it could be. Hope you solve it!
Hi! loving following these tutorials, signed up to your patreon but I cannot find the battle backgrounds in the files ? can you point me to them please.
What camera dimensions are you using? I started with default camera setup, but seems to have messed me up for this video. Mine is a less tall, wider rectangle and orthogonal projection.
In the game tab, try changing Free Aspect to Standalone
Hello @Game Dev Experiments , Love the tutorials. I was wondering about your text you imported, i tried to include the image and the meta file and it won't recognize it. I see alot of people using text mesh, was wondering how you set yours up. Thanks for any and all help!
nm, i thought you were using an image, i downloaded the wrong file haha. The ttf file is what i was looking for.
@@awkwardlycharming Yeah it's just a font :)
sir mine is not working every script compiled the right way, but still its not changing the name, lvl or pokemon sprite. please help me
You might have made some mistake in the code. You can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it in this video.
ruclips.net/video/al2LjGRRcu8/видео.html
Ive been using Text Mesh Pro instead of normal Text, and while Ive been able to follow along wherever you've used Text, without getting errors, I simply cant get it to update the Pokemon's name and level after setting them in the inspector. Am I missing something to get it to work, or should I just switch to normal Text?
Text mesh pro should also work fine. I'm not sure why it's not working.
I have the same problem, have you found a fix?
You have to switch from “Text” to “TextMeshProUGUI”, also you have to be using the “using TMPro;” namespace.
For anyne new having this problem. Dont use TMP in the create tab in UI there's a option called Legacy where you can use the base text
Why does my camera shape is rectangle in the left but ur in downside
please help
Edit: nvm i figured it out
20.25 what you were doing did not work for me. I have to add " Monster Stats; " to call the Monster class like that for me to have access to the Property. Unno if its cause im using a newer unity version or maybe its how c# has been updated. DOnt know but anyone else who cant get the property to show I suggest calling the class
did you manage to complete it?
Awesome tutorial man, this is really helping me a lot!
Not sure if you'lI end up seeing this or not but I'd like to ask something:
I was having an issue with the setup battle method in that unity was flagging up that there was no reference set for 'Pokemon' in 'BattleUnit' (playerHud.SetData(playerUnit.Pokemon), this was not the case and I checked through the code many many times and I couldn't see an issue with it. And then without me doing anything or changing anything about the code it just started working which left me feeling really confused.
So my question is, does this happen to you at all? and is it common for the software to make a mistake like this?
Thanks man for the feedback. That's weird, There are rare errors that gets fixed once unity is restarted. But I haven't got any such errors yet.
@@GameDevExperiments Yeah I've actually figured out what my issue is now, it seems I have a slight bug with Unity in that it doesn't compile all the scripts when closing or minimising visual studio, only the one I was last editing.
To fix it i basically have to go through every one of my scripts and save and minimise them one at a time, which is abit annoying
Keep it up man, I've learned so much from you in only a few videos!
I'd love to see you run through other kinds of games too, roguelikes are a genre I'd love to see in action.
My Camera has width and height does not similar this video. Can someone help me fixed?
Good Stuff!
Thanks :)
Very good tutorial. My only issue is that charmanders sprite leaves the battle backgrounds bottom border and overlaps the black border of the dialog box as charmander is slightly bigger than bulbasaur on the sprite. Did i miss something?
Thanks for the feedback Erik! You didn't miss anything, that's an issue I didn't fix yet.
thats all i need to create my question type :3 with pokemon style thanks !
Thanks for the feedback :)
@@GameDevExperiments really nice work! subscribed !
can you help me man? i think we're creating the same game and I wanna create a random question type, it's for my thesis project :3. I just wanna know some tips to finish it early before december :(
Hey man, I've been enjoying the videos so far, but I can't get past this one. I've got the scripts copied word for word, allocated them to the proper elements and watched this video over and over to make sure I'm not missing anything, but the sprites and HUD elements just don't change when I run the game.
The only difference I can see between what I'm doing and the video is when I rewrite pokemon to be upper case in the battle unit script, it doesn't change in Battle System at the same time. Not sure where I'm going wrong or if it's something up with Visual Studio/Unity?
You can add breakpoints in visual studio and debug to find out what's going wrong. I've touched debugging in part 13 and In the next 3-4 days I'll release an entire video on debugging and fixing issues.
unity don't have the option "text" anymore, its so sad cus to put a font is so hard right now
I don’t know if you are still commenting or if some one can help it won’t show the moves on the battle screen just shows the line where the 4th move should be
I'm not sure what the issue is. You can add breakpoints and try debugging in visual studio to understand what's going wrong. If you're not familiar with debugging, I've covered it slightly in part 13.
Hello there. Im having a great time with your series but there's this weird error popping up.
whats the meaning of this error?
MonoScriptImporterInspector.OnEnable must call base.OnEnable to avoid unexpected behaviour.
UnityEditor.Tilemaps.GridPaintPaletteClipboard:OnDisable () (at Library/PackageCache/com.unity.2d.tilemap@1.0.0/Editor/GridPaintPaletteClipboard.cs:347)
how can i solve this?
Wonderful series thank you for doing this. How would you implement your battle system in a 3D setting instead of 2d?
I'd create a prefab for each Pokemon's model and then I'll store the prefab's reference in the Pokemon's scriptable object.
@@GameDevExperiments thank you for the reply, someone on your discord suggested the same thing so I tried it and it worked and with animations. Also I’m a Patreon supporter and I didn’t see a tutorial for the ability system but I found the files for it that you provided. I’m following your videos because it’s teaching me a lot but after which video would you recommend inserting that code?
@@shadowartz9968 Thanks for the support! Try to read & understand the code for the abilities before adding that to your project. I recommend starting abilities once you watch the first 50 videos in the series.
I'm having an issue at the end of the video where we test to make sure everything works. the enemy pokemon just comes out as a white box. after about an hour of messing with stuff i used the provided files from your patreon page and it still wont work. not sure where it went wrong.
Nevermind i figured it out... in my pokemon resources i never added the back and front sprites to any pokemon besides charmander
16:31 || Bro my health Bar(green) just disappears(it doesn't show half health)
It is also constantly giving this message in the console
"There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene."
That error message is because the Battle System game object is not disabled. Try disabling it and test.
@@GameDevExperiments By disabling the battle game object the error was gone but the
(by the way thanks for your response but)
The real problem was that the hp bar was not showing and it isn't showing now also
(In fact the whole battle system disappeared)
@@cardiacorca3176 That's weird. You don't see any other errors in the console right? can you try debugging in visual studio to figure out what's going wrong?
@@GameDevExperiments Plz Tell Me How To debug with visual studio I really don't know
@@cardiacorca3176 If you haven't done debugging before, I've covered it slightly in part 13. Basically you can add breakpoints and try to understand how the code is working. In part 13, I used debugging to demonstrate how the code is working.
this method isnt really working for me. I get an error saying i must use a scriptable object. Im using Unity 2022 would that make this kind of difference
Edit ***** I finally got it working.
I get an error when in my BattleSystem script about the SetData. It says: "NotImplementedException: The method or operation is not implemented. BattleSystem.SetupBattle () (at Assets/Scripts/Battle/BattleSystem.cs:21)" Please help, I have no idea what I did wrong. I've followed your tutorial but I've very little experience with coding. I'm just completely stumped.
And my playerHud and enemyHud doesn't change from my test text to the right pokemon text.
@@jensjohansen8050 The error says that you haven't defined the SetupBattle function. Make sure it's defined with the correct spelling.
@@GameDevExperiments yes of course. And how? I've spelled everything correctly. Can the error come from elsewhere?
@@jensjohansen8050 Can you upload your BattleSystem script somewhere and share the link here? I'll look into it when I'm free.
@@GameDevExperiments I deleted the scripts and tried again. It seems like I must have misspelled SetData at some point. It's fixed now. Lesson learned =D
In the script for Battle Unity, they say "For testing the system, we'll set these values in inspector, but later on we'll set these dynamically when we start a battle". Can someone point me to which video they change this code later on? Much appreciated.
It's changed in part 12 I believe.
amazing work! i have a small problem right now and it´s that the front and back sprites are not recognized in the coding, and i don´t know what´s wrong...
same here. any fixes?
@@enthusigasmofficial5892 i havent had time to sitt down and look at it yet, but if i find the problem ill tell 🙂
@@enthusigasmofficial5892 i found my issue, it was that the SetData part in BattleSystem was a private class and not public class. though im vary sad right know because all of the world build i did was gone lost and i need to rebuild it again.... though all of the code and sprites are still there :)
What was the reasoning behind making BattleUnit instead of having the BattleUnit logic in Pokemon? Was it because you wanted the BattleSystem to not have the Pokemon class in it as a SerializableField? Or was it because that's the only place that you could define specifics about a specific Pokemon (such as what level this particular pokemon is) without putting it in the BattleSystem or making Pokemon objects for Charmander lvl1, Charmander lvl2, etc? Been enjoying the series but wanted to understand at a high level what the thought process you had of structuring your solution this way was. Thanks.
Right now I'm setting the pokemon and level of the battle unit from the inspector. This is just to make testing battle system easy. In the future videos, I'll set that dynamically when the battle starts. Pokemon class will be used in many other scripts, for example, the map script will have the list of pokemons in that area, trainers will also have a list of pokemons etc. so making it a plain class made sense.
@@GameDevExperiments Will you be instantiating BattleUnit in your BattleSystem?
I cannot fix this error. Can ya help me fix it? Thanks.
NullReferenceException: Object reference not set to an instance of an object
BattleUnit.Setup () (at Assets/Scripts/BattleUnit.cs:20)
BattleSystem.SetupBattle () (at Assets/Scripts/BattleSystem.cs:19)
BattleSystem.Start () (at Assets/Scripts/BattleSystem.cs:14)
Looks like some object in line 20 of the BattleUnit script is null. You can try adding breakpoint in that line and check what's happening. I've made a video that explains how to fix null reference errors ruclips.net/video/al2LjGRRcu8/видео.html
can anyone help me my sprites are being little bit down while playing the game
23:46 it is giving me an error " Cannot implicitly convert type 'string' to 'UnityEngine.Sprite' ". Pls help me in solving d error. Btw I love ur vids. Very Well Explained
In the PokemonBase class, make sure the type of the BackSprite property/variable is Sprite and not string. Thanks for the feedback btw :)
@@GameDevExperiments Oh thanks a lot man! (That was actually a really bad question from my side xD ). Im surely gonna recommend ur channel to others too :-)
@@liveish8260 Thank you for the support :)
Hi
I just need to ask one thing.
When my battle camera is activated and I try to see the game screen then there's a black screen and on the left bottom my battle canvas is visible.
Battle Camera has the same size as the Battle Canvas, i have checked it twice.
So, any idea why's this happening.
Did you try scaling the image so that it fits the canvas?
@@GameDevExperiments Thanks for the reply but somehow I figured it out!
when writing the battleunit code I keep getting a cs0246 error saying that the type or namespace name of pokemon could not be found, I understand that it should be identical to the name of the constructor in the pokemon script. But even when I change it seemingly won't recognize that I am putting in the same name. I have tried copypasting directly from the other file so Its not that I am typing it wrong. I am just not sure what it could be, I thought it might because the file and method have the same name. But any help would be appreciated.
Nevermind I figured it out, but for anyone that was curious I had left the void in the constructor accidently from a previous video and it gave me an error when I tried to because the name of the class and the constructor were slightly off because of an accidental capilization. after fixing the spelling and removing the void it starting communicating with the other file.
@@cabbage_meme7814 Glad you fixed it :)
For a 3D game, would you recommand to teleport the player to one side of the map with an other camera, UI and all, or loading a different scene ? Though, is it possible to save your position before battle and return there when it has ended
Great series by the way
I would prefer the first option. I believe both option has its own pros and cons.
Hey I got a weird problem with the health bar, as soon as I start the game the green image is invisible, I checked the inspector and saw as I press play the image scale get changed to 0 on the Z axis.
I tried to put 10 as default, but when I press play it always gets changed to 0?
When I change the script on 16:10 to new Vector3(0.5f, 1f, 1f) it works and the Z axis stays at 0, but why did it get changed to 0 by default in my game but you seem to be fine with just declaring x and y?
You saved my ass man, thanks!
yo, I can't assign my pokemon to my battleunit. It says that the assigned script doesn't match, but on my actual pokemon, i can't choose a script
You're having a problem with basically every video. Maybe try to find a solution before asking a vague question then saying "oh nvm I just did x" every time. Just comes across as lazy/you being in over your head.
Yeah sorry I kinda am in over my head lol
I love the Series! Since im very new i learn a buttton of things to use. But i got one question ... instead of a Sprite for back and front i want the program to grab a 3d Object. i tried to simply replace the part with Mesh instead of Image (i also did this in the initial refrence) but i cant grab it with the "GetComponent" ... I spent the whole day banging my head against the wall on this today ... maybe im just stupid and its really easy but ... as i said im new ^^'
Thanks for the feedback! If you want it to be 3d, In the pokemon class, instead of having a sprite for front and back, you should have a reference to a gameobject. To this field, you can attach a prefab that contains the model of the pokemon and finally, you can instantiate this prefab when the battle starts. So you'll have to create a prefab for each pokemon.
@@GameDevExperiments I have tha same problem... i understand what you are saying, but somehow i can not manage to do it. Can you explain in more detailed? I copied all of your scripts, the only difference is that in the "pokemonbase" scripatble object script i used [SeriealizeField] GameObject enemyobject instead of sprites.
I would be greatful if you could help me with screenshots or something like that.
Did you manage to get this done?
I seem to be having some slight issues regarding this. When I try to test the game, nothing seems to change. The player's sprite doesn't change to Charmander, the names and levels of the pokemon don't appear either. There doesn't seem to be wrong with the scripts. It's just that they don't seem to be doing anything. Can anyone give me any advice to rectify this?
My issue was resolved after I found out my hp Bar script didn't have references. At first only the player unit loaded.
Hey, i can't get why, when i launch the game my Charmander Name Lvl and Sprite are displayed right but the HP bar is always empty, i've got this problem since i add the BattleSystem Script in the game, before that the HP bar was full, hope you can help me because i already watched your debugging video and i can't get it to work, (sorry for poor english, isn't my primary language)
Here my BattleSystem Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BattleSystem : MonoBehaviour
{
[SerializeField] BattleUnit playerUnit;
[SerializeField] BattleHud playerHud;
private void Start()
{
SetupBattle();
}
public void SetupBattle()
{
playerUnit.Setup();
playerHud.SetData(playerUnit.Pokemon);
}
}
Have a nice day :)
This series is super helpful! But, I’m getting an error in the BattleUnit script. It says that PokemonBase doesn’t have a definition for BackSprite or FrontSprite. I’ve copied all the scripts as best I can but I must have missed something. Do you know what it could be?
Looks like you didn't create the property for BackSprite and FrontSprite. If you've created then make check if the letter case is correct. That is, it should be BackSprite instead of backSprite.
@@GameDevExperiments i have same problem too. it appear PokemonBase doesn’t have a definition for BackSprite or FrontSprite. I try again and again still error. How to solve it eh?
Hi how can i fix this error
NullReferenceException: Object reference not set to an instance of an object
Pokemon.get_MaxHp ()
You can add breakpoints and try debugging in visual studio to understand what's causing the error. If you're not familiar with debugging, I've covered it in this video.
ruclips.net/video/al2LjGRRcu8/видео.html
@@GameDevExperiments hi again im still stuck in this part but i saw that the the input of the hp and level are 0 and moves and base are null
Pokemon:
Base: null
Level:0
HP:0
Moves: null
i think the problem is somewhere here;
HP = MaxHp;
Base = pBase;
Level = pLevel;
Moves = new List();
@@genesisz2253 Are you getting any errors in the console?
How do I fix it if the opposing Bulbasaur doesn't show its name when I start it?
Do you see any errors in the console? Btw ou can add breakpoints and try debugging in visual studio to understand what's actually happening. If you're not familiar with debugging, I've covered it slightly in part 13. There are also other tutorials for it on youtube.
I had the same problem and then i realized the issue was i typed the code as enemyHud.SetData(playerUnit.Pokemon);
instead of enemyHud.SetData(enemyUnit.Pokemon);
Hi,
I'm facing a problem and that's when I enter the play mode , the HP bar becomes invisible and I don't know what's causing the problem.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HPBar : MonoBehaviour
{
[SerializeField] GameObject health;
public void SetHP(float hpNormalized)
{
health.transform.localScale = new Vector3(hpNormalized, 1f);
}
}
Is there anything I missed or messed up.
There is nothing wrong with the code. You can try log the value of hpNormalized and verify it's not zero
@@GameDevExperiments Sorry, but how should I do that, I'm new to C# scripting and don't know how to do that.
@Blender World Just add Debug.Log(hpNormalized); at the start of the SetHP function.
BTW If you're new to C#, I recommend spending few days learning the basics. Once you know the basics, it will be easy to follow along this series.
@@GameDevExperiments Thanks for this but still the health bar is not visible though I can see the change in health in console.
One more thing, the value is not set to 0.
Everytime I make the hp bar script and try to assign it to the hp bar, it tells me it can't be assigned because the class isn't recognized.-.
Make sure the name of the script & the name of the class are same.
Is there a way I can use 3d models and still follow this tutorial? (I used an GameObject in my script instead of sprite front and sprite back)...I'm extremely new to coding
Yes you can use GameObject if you want to use 3d models.
@@GameDevExperiments Thank you so much for replying but how do I use a Gameobject instead of a sprite in the Setup? I'm sorry if I am a bother but if you wouldn't mind helping me with that line? When I release my game I'll give you full credit
@@thesleepyninja4522 You have to create prefabs for each pokemon models and then assign it to the Gameobject field of the scriptable object.