Unity 3D Tutorial Part 98: Making A Shop – The New GUI: Part 2

helly tube sound bite and then putting jump straight in hopefully these videos will have uploaded one after over so you can actually see what to do is he not to set their board because it was a bit annoying so managed to fix it and literally I just played over the numbers and it showed all but then I will sink in well we need to increase the size because that’s the end of it so let’s change the high as you can see nothing happens that I was racking my brain oh my god wise you’re not working then i looked at the script let’s see blah blah blah blah blah the position will be X correct position will be why create the width will be X we and the way will be y that’s not right so it should be this size will be with massage behind the other one was different that’s why so now this should work a lot better so we can make it look like a real scrollbar now so let’s stick it in as one over here I’ve moved it closer so we’re not waiting all the time let’s see it’s now disappeared of the height so let’s bring it back up it’s changed about 95 and change the width come back here perfect so let’s move it up to about there so it’s gently coming on and this x over scroll bar is everything inside of it so if we see it’s too small so we can increase the width so if we move the X across until it reaches the border there then what we can do is just scale it to let me to the right place for her what the hell is that sound like a cat be run over mine so let’s move it around so drag it up perfect so now we have a scrollview working it did it again that’s weird and even know what that is but yeah so now we can scale the Y down so the high to this one yep so put it there then we can scroll down ah perfect it’s getting there we’ve gotta do is scale it a little bit more using the height on this just to make sure we get everything in perfect there we go last one so let’s just drag it up and put it around there so we now have everything in a scroll bar so what’s left is to make these look nicer switch it and then be happy that it works or it can have to have done this what we’ll do we’ll stick it in the cell box as well so we have both that the cell box have to be coded differently because the cell box will have to show our inventory rather than show what can buy again cuz that’s a bit with unless you want it like that no I’m not online computer with that but yeah so 52 oh dear ardara for that wasn’t you they would that noise is driving me crazy now you probably can’t even hear it so I’m going to speak to spit up while I just apply these numbers to the actual thing and then we can get rid of it so I’ll be back in a minute so I’m back we’ve done it now what we need to do is instead of having in fact we will keep two variables so we’ll copy these two variables and paste it in here change that one to the scrollbar one and we’ll change this to sell bar over but instead of this will change to stop the Y of X of it i mean to say 200 just so we can see the clear difference and we’ll name this again to sell grid and sell current scroll and we’ll drag it across this will be called cell again so we can do is paste eighth and okay go back up top we need to remake this variable so all this pit is is just copying and pasting what we just basically just done so it’s not really hard so get rid right I need to just

quickly make the numbers back across 28 60 51 and the other one is I’ve just put the wrong numbers in I’ll be back in a minute once I’ve done it so I’ll speed it up go okay some back doing it that was kind of annoying but so let let’s jump in and we should hopefully see it work remove the wrong one all right so we’ll just start messing with the cell one that’s why the cell one’s completely different but we know where everything is so we can just adjust it that’s a bit weird oh yeah the sizes again yes so the width will be that the height will be that and the same again for the sole 10 the seller won’t so that will works are the cell bonders so let’s move it around to the right place and we’ll move it down perfect so now we’ve got to scrub our sweet thing and it works perfect so a BB that number and it will be 84 as well so we’ll paste it I’ll jump the numbers across again then I’ll join you back again I’ll meet operating the inspector this time then after I come back we’ll start doing the quantity boxes so go okay some back works perfect now so fill the speed up so I’ll try not to I might actually cut some of them out instead it when did did they were music every two seconds but so we’ve got a scroll bars it looks really really nice I think it does look quite good that’s why I originally thought go stuffed back up all functioning we can buy stuff that we can also buy stuff from the star box two separate scrolls so you can see perfect only thing is with this scroll box is will have to make it also adjust when we do the selling one to suit your items so yeah we’ll fix it when we get there so we’ve got our bio cell bones we need to do the quantity buttons now so the quantity boxes are actually relatively easy so I’m going to do is again create some more variables which is taking them it yep so by and we’ll put one city I really don’t have small quantity I just put them down spot on that Devil silly so we’re going to make it the same this is the 101 the button yeah but will change the x-axis to say something light room 20 so it’s a little bit higher 30 and that seems right so do the same for this cell amount one this time we’ll go to rheank well we need to change it okay there we go so now we score them and we’ll just look in where we need to put it and we’ll just put this will need to make this a little bit me can still close by put this here and so just try to make it a little bit neater so we know where things are it’s the wind that’s where is it sounds like a cat it’s the wind blowing through when you mix it’s quite windy today but yeah so we’ll do it here so you know how to do the text box it’s really really easy first we need a string even though than this before agent Lee Adams before if we could copy and paste it it’s a safe time now it’s made right again so tight private VAR x amount please myself calls it that as well ah x amount text this will be a string and or equal to 0 what will eventually do is put some light effect some special text I kind of Italy marina input mask so you can only put numbers in validation rules that’s it I did database I should know this stuff so so amount will be 0 again so the both default we start off at 0 so no matter what in fact wand the bo staff at

once I’m about what if you click Buy button it’ll automatically by it and if it ever equals nothing then it will just don’t matter to make equal one just do it all try and stop people trying to break it so in here we’ll type x amount xt equals GUI text field wreck put our rectum in a minute text name and amount char letters well we work with by more than 100 someone to really three yeah so go up and will copy by a noun come down and we’ll paste it in here paste copy this and paste it in here so so why fight them all the rest like that this may throw an error but I’m just testing something let’s see yes I know what of them so in here we need to copy all of this and paste it after this and then we’ll copy this one I forgot to put the way it’s texts and everything but then it look just so normal I was like well that might want it then so now it should work Greg does not much just a target string so let’s see what we’ve done wrong string what line is it 10 to this one lastly what let me plug done it again and copy all this paste it in here oh dear come on select boom oh that ok let’s try again x is not number of string where’s up or x 10 to get a text field by amount text it’s not called text goodbye oh man why not maybe that that’s a bit weird I’ve got same for this one I have I’m after my game today people right work please work please please please please please please yes right resolve we’re in as you can see unity is made up of scroll bars to which thing we be messing with so let’s try again hello Oh perfect we just need to adjust the sizes and the buttons and everything when we do click it both shows so we can move the quantity across with can edit it so we want by 100 yet it doesn’t work for now but tiny modification it should work so where is it by amount let’s move the X across talk about their move the width to 10 oh dear now lesson time less than 10 slightly less little bit less because I want it to become like not touching but ever so close daddy so we need the width of it to be 95 and the X amount to be 50 and the warm of this one is be around so apply this into the script it should be really really simple we’ve got a really long shot going on but it will be a really good shot so for the x amount it’ll be 15 to 64 95 and time again 95 and one AAA so 15 95 188 95 so let’s try again 18 895 isolate was 15 15 18 25 perfect play again we should have our quantity done Oh smoke messed up we paste it in one place that’s why I place their own place i pasted the width is it into the y axis with moved or here perfect really really think commonly on shop now it’s getting really good so we can click it will need the names and everything but then we can type say I 1

100 and it will buy it but we need to convert that to an integer which we’ve done before which is easy to do and we’ll need to put the description on if the item we’ve clicked so what we need to do is make it so if we click one it makes you over 1 minus 1 if you understand if not we’ll do it now it’s a grid value we need to separate one for by grid value and sell good value if I grabbed by grid value will make that I’ll a good value for x I really want to play like it oh don’t mind talking it off again I just synced about a game when I talk about grids I really don’t know why but yeah fallout was the game I want to play that game again so I’ve got all that stuff in we need to make a new grid so grids don’t give a content so we’ll see by grids and sell grids so for every time it says grids they’re as you can see this quite a lot what’s a oz lime wash them sell bonus here so grids for that one and by grids for this one and then we also paste the cell grids one in so sell grids for that so now we have two separate ones but we still need to make your own variable so where’s our grids the bit what’s got all the grid buttons that one so stick down by and we’ll call this by grid buttons and we’ll name this one to have a guess go on you all know it cell grid booms so start with by good bones this game really annoying buy sell buy sell buy sell I’m gonna be glad when the shops doing but hey that’s what we’ve got to do five good ones by grid buttons by good poems by four foot ins can you hear like wind that is terrible so we’ve got two separate grids now completely separate hopefully it works so see if it works I know I don’t play grid buttons one away as I want to eat but i’ll wait oh good buttons wait what did it just changed to what we’ve been changing Oh Lord we’ve been changing something it’s all good buttons and baggage battles now i will change the text field 11 no fail so good ones oh I should have read it my fault so as I text box by amount is this one here and sell amount that one here right test two grid value that’s good we’re getting better tomorrow so if we scroll up we have these ones here so by grid value is there and there and sell good value perfect so in here we’ll paced by grid value and then here or paste so good value so a bond of here what we’ll do is paste this bit here so if by grid value is less than 1 it’ll show the Bible too but then why they’ll also do is make the cell grid value equal minus 1 however else I hope this works this is serious if cell good value does not equal minus 1 that means it’s being clicked then it should return it and pull that there we may get a glitch and we may never ever be able to click the cell with them but it may work let’s try it it’s all experience isn’t it programming you just got to keep trying trying this vid to toys gone wrong again so we have a thing why I’m guessing we haven’t signed any grids yep look at that so we’ll say one and we’ll put an apple in on the seat

for number one poke and we’ll see that one no way to follow this power be quite cut even though it’s not a cat 12 and for the kosel grids we’ll just put a blank grinning and again tall and we’ll try again then this is a shop almost complete they’re so getting perfect oh well better what this will just change yeah we now have two independent schools so we can have different ones and you should be able to buy it for each one so as you can see we can never ever get the cell 1 i’m bill to fix that another time so the greens are getting better all the swim in description next time we’ll continue working on it again so thanks for watching I really hope you liked it sorry they’ve been so long and if you didn’t like these I apologize but it’s part of game making and see you next time