Simple Shop System in Unity - (Part 1)

  Рет қаралды 34,817

GDTitans

GDTitans

Күн бұрын

Let's make a Simple Shop in Unity!
● Part2: • Simple Shop System in ...
● Coin Pickups Tutorial: • Coin Pickup System - U...
● Simple Cars Pack: bit.ly/3gDc49c
♥ Don't Click This! : bit.ly/2Zi3vu9
♥ My Second Channel: bit.ly/3jvI8g6
--------------------------------------------------------------------
✅ My current Productivity Setup 👇:
● Gaming Headset: amzn.to/3HyXgp2
● Gaming Mouse: amzn.to/3ni4Ygp
● Best Webcam: amzn.to/44pVUqw
● Keyboard: amzn.to/3ALXB3M
● GPU: amzn.to/42mylNt
● CPU: amzn.to/44lOBjs
--------------------------------------------------------------------
FOLLOW ME:
● Facebook: / developer3.5pro
● Sketchfab: sketchfab.com/GDTitans
--------------------------------------------------------------------
► All content by GDTitans is 100% free. I believe that education should be freely available to everyone.

Пікірлер: 172
@hannanbati
@hannanbati 3 жыл бұрын
Am watching your video for the first time and you make me a fan of your teaching method. love You and Keep growing
@B0g3465
@B0g3465 3 жыл бұрын
I Simply love your channel, your coding skills are smart! Best Unity Channel, thanks for the great educational content!
@GDTitans
@GDTitans 3 жыл бұрын
Thanks, I appreciate that.
@sevendaygamestudio7925
@sevendaygamestudio7925 3 жыл бұрын
The best shop system tuto I ever seen, thanks for this great tuto keep going.
@GDTitans
@GDTitans 3 жыл бұрын
Thanks for your encouragement
@syedsadiq8631
@syedsadiq8631 3 жыл бұрын
@@GDTitans ya it cool but can you make for different guns and how we shoot and use plz i am u subscribe
@syedsadiq8631
@syedsadiq8631 3 жыл бұрын
@@GDTitans gun buying system
@vinimaykaul
@vinimaykaul 2 жыл бұрын
@@GDTitans really nice tutorial videos man. Loved them all. Thank you so much for your time and energy spent in making them...
@spidersense1639
@spidersense1639 3 жыл бұрын
Please upload the next part of the video as soon as possible ❤️❤️ This is very helpful 👍
@UnityGhost1212
@UnityGhost1212 11 ай бұрын
very nice demonstration. I love it.
@Demon.Immortalis
@Demon.Immortalis 3 жыл бұрын
exactly what i needed thanks
@aymansushi9250
@aymansushi9250 3 жыл бұрын
Woow ! Great video man ! Helped soo much thx
@GDTitans
@GDTitans 3 жыл бұрын
I appreciate that.
@exTRemeYT_
@exTRemeYT_ 3 жыл бұрын
Thanks you for great tutorial 😀👍
@shaiksabihatarannum
@shaiksabihatarannum 3 жыл бұрын
So thankful to you sir.. Your videos are really helpful....Easy to understand and very clear.
@GDTitans
@GDTitans 3 жыл бұрын
Thanks, bro
@gamedev_navneet
@gamedev_navneet 3 жыл бұрын
Thanks for this video.
@shaheentechnologies4649
@shaheentechnologies4649 3 жыл бұрын
Thanks a lot man
@a.technology1446
@a.technology1446 3 жыл бұрын
Need it so long, thanks 👍
@GDTitans
@GDTitans 3 жыл бұрын
Don't mention it.
@mezorai4866
@mezorai4866 3 жыл бұрын
That's what I've been searching for...Thanks, man!
@mohamedazahrani4427
@mohamedazahrani4427 Жыл бұрын
Thank you very much 👍🏼
@GDTitans
@GDTitans Жыл бұрын
Thanks brother
@mahmoudashraf1207
@mahmoudashraf1207 2 жыл бұрын
Thank you!!
@rabiehaddad1925
@rabiehaddad1925 3 жыл бұрын
This is amazing thank you
@GDTitans
@GDTitans 3 жыл бұрын
Thanks,
@acikgozemre
@acikgozemre 2 жыл бұрын
Thank you!
@grees9996
@grees9996 3 жыл бұрын
Omg you save my a** thanks bro love you
@AliHassan-on3pr
@AliHassan-on3pr 3 жыл бұрын
habibi u are best i was looking for it and found it
@SajjadAhmad-pe3vw
@SajjadAhmad-pe3vw 2 жыл бұрын
Very good concept
@GDTitans
@GDTitans 2 жыл бұрын
Thanks 😊
@syed.muneebmalik2669
@syed.muneebmalik2669 3 жыл бұрын
Thank you sooooo muck Plz make videos like this
@modnashri
@modnashri Жыл бұрын
Thanks alot my friend
@GDTitans
@GDTitans Жыл бұрын
No problem
@emielv8365
@emielv8365 Жыл бұрын
bro, ur a legend
@GDTitans
@GDTitans Жыл бұрын
Thanks man
@noufelaouati8929
@noufelaouati8929 3 жыл бұрын
Thanks bro you're the best ❤ very very helpful video
@GDTitans
@GDTitans 3 жыл бұрын
Thanks, I appreciate that.
@user-nq5zr9hd6t
@user-nq5zr9hd6t 9 ай бұрын
thank you for video
@GDTitans
@GDTitans 9 ай бұрын
You are welcome
@sapy4124
@sapy4124 3 жыл бұрын
Best tutorial i have ever seen
@GDTitans
@GDTitans 3 жыл бұрын
I'm glad to hear that
@sapy4124
@sapy4124 3 жыл бұрын
@@GDTitans but there is a problem....if i select one of those players, the camera does not follow the selected player... it remains still... will you plz share ur instagram ID to share the errors?
@afterEffects_0
@afterEffects_0 2 жыл бұрын
Thanks Brooo.
@GDTitans
@GDTitans 2 жыл бұрын
No worries 👍
@cometgamerid
@cometgamerid 5 ай бұрын
Very nice tuturial ❤❤
@GDTitans
@GDTitans 5 ай бұрын
Thanks
@cometgamerid
@cometgamerid 5 ай бұрын
Brother can you make it more simple. Bcz its easy but still difficult, it'll also help you make easy tutorials.
@richardedmonds-phillis9930
@richardedmonds-phillis9930 3 жыл бұрын
Loving the videos just what I needed keep the great work up. I have just one question what script are you using for camera follow player have you one for each player or have a scrip to follow just the active player. I am having trouble as the inactive are stopping the active player moving far.
@GDTitans
@GDTitans 3 жыл бұрын
Thanks I appreciate it. Yeah the camera follows the object with the tag "Player".
@richardedmonds-phillis9930
@richardedmonds-phillis9930 3 жыл бұрын
Thanks much appreciated thanks for pointing me in the right direction. Looking forward to more brilliant tutorials.
@nitesholi8645
@nitesholi8645 2 жыл бұрын
it`s an amazing tutorial
@GDTitans
@GDTitans 2 жыл бұрын
Thanks 😊
@maxshinobi6092
@maxshinobi6092 2 жыл бұрын
Hey, great tutorial! The only issue I had, were the curly-braces { } after foreach and if statements. Seems like your code editor allows for { } to be skipped, but in most people's cases, they are mandatory, so make sure to use them, as it is really confusing and game-breaking without them. Cheers
@max.playsgames
@max.playsgames Жыл бұрын
you can skip them if you only do 1 line of code below the if statement so the code is neater, if you do more than 1 line you need to add them in
@maxshinobi6092
@maxshinobi6092 Жыл бұрын
@@max.playsgames oh thanks, i didn't know that one
@cytrof
@cytrof 2 жыл бұрын
Great Tutorial. But can you help me please? I have problem that the main camera won't follow the player that i chose except the first player in array. Thanks before 👍
@TheKING-tm9so
@TheKING-tm9so Жыл бұрын
Hello, thanks for this wonderfull tutorial i have been working on Endless game when i select a character in the menu scene and i start the game i found that the player is not the one that i selected, in level secene i changed the player GameObject to characters holder and i added the prefabs to it, i don't know if it's the right way to do it , i have been stuck here for weeks hope i get some help in this, Thanks .
@jadrielduran3264
@jadrielduran3264 2 жыл бұрын
I have a question on a proyect i'm working using this script, how i do the selection part with multiple button instead of arrows?
@sandeshjamakatel8742
@sandeshjamakatel8742 Жыл бұрын
hey how did you saved the score you have not mentioned it on any of videos I followed you upto here but at last disappoinment
@wiseriz9898
@wiseriz9898 2 жыл бұрын
You are absolutely great and smart!! I love your videos...... They help me vehemently :D Hope you keep up and earn fame ^_^
@Andrxano
@Andrxano 9 ай бұрын
do i need to change the codes if i want to add more cars in the CarsSelection ? or just simply drag 'em to inspector ? Edit : nvm, i fixed it
@supteam4209
@supteam4209 2 жыл бұрын
Hi, why does give me missing object when I assign the players with script at the player's Holder, and when I tray with cube sphere work fine without problem. thanks!
@mobin9675
@mobin9675 Жыл бұрын
Hi, For Start buttton what script Are you using and somthing else, Every car i'm select in menu it's doesn't come in to level just first index car is being true
@dtv4142
@dtv4142 2 жыл бұрын
wow!!!
@vaibhavjaiswal799
@vaibhavjaiswal799 3 жыл бұрын
Searching for proper tut like this for long.....please upload second part soon
@GDTitans
@GDTitans 3 жыл бұрын
Thanks, I will upload it Tuesday or Wednesday
@kodandaraochellapilli6212
@kodandaraochellapilli6212 7 ай бұрын
Where can I find the assests and I wish you would show from the beggining
@MusicFlowDaily
@MusicFlowDaily 2 жыл бұрын
*Hi, much luv for the tutorials! :)* How to make it possible to buy a doubling of life in the shop? let's say usually in the game there are 3 lives, I want to be able to buy 6 in the shop (for just one session of the game). I can't find any tutorials on that topic. :(
@kodandaraochellapilli6212
@kodandaraochellapilli6212 7 ай бұрын
Please help me where can I find the main menu scene
@sweetsfromcandys2847
@sweetsfromcandys2847 Жыл бұрын
Hello, thank you for your tutorials. I have a question, and I would much appreciate it if you can help. I have completed your shop system and it all works perfectly. My set up is a bit different from your, instead of pressing next to see the next car, I have manipulated the code so all the cars show at the same time on the screen, I'm just wondering if there is a way to have a separate buy button underneath each car separately, I have been at this certain problem now for over a week, and I am pulling my hair out, so please could you direct me in the right direction, I'm fairly new to c, so if you can help will you please explain in dummy terms, thank you again for all your efforts, they are much appreciated within the unity circle :):):)
@sweetsfromcandys2847
@sweetsfromcandys2847 Жыл бұрын
I seem to have put this message on part one, but it is meant for part 2 :)
@deborahokoro2449
@deborahokoro2449 Жыл бұрын
I have a problem in shop system i followed all the steps and i got it right when i started using for character purchase i got a massage in Shopmanager saying "index out of range exception: index was outside the bounds of the arrray". Pls how can i fix it
@sharonteohsuetmun5644
@sharonteohsuetmun5644 3 жыл бұрын
Thanks sir for the awesome tuto video. BTW, my question is after I select the car and start the game. Then, after I go back to shop again, the car is not rotating. Hope you can help me to solve this issue.
@lynnpham
@lynnpham 3 жыл бұрын
i face the same problem.. did u find a solution?
@minaadeeb6870
@minaadeeb6870 2 жыл бұрын
very nice you explain very good. from where are you man.
@GDTitans
@GDTitans 2 жыл бұрын
Hey, thanks I'm from Tunisia
@kodandaraochellapilli6212
@kodandaraochellapilli6212 7 ай бұрын
Where can I find the scenes ?
@musicland5786
@musicland5786 3 жыл бұрын
But how you make start button and coin counting
@infinitystudio2286
@infinitystudio2286 Жыл бұрын
my characters in shop get oprned where i left, its not working on default position if i click next or prev, it stays on that model. Also animation is not working for any player on game mode
@Apricot0034
@Apricot0034 3 жыл бұрын
If the object you selected does not come to the scene although you write the codes, the edited codes I have thrown can be useful for you, you can change the object names according to your own I made it for the car.
@Apricot0034
@Apricot0034 3 жыл бұрын
using UnityEngine; public class CarSelect : MonoBehaviour { public GameObject[] cars; public int currnetCarIndex; // Start is called before the first frame update void Start() { currnetCarIndex = PlayerPrefs.GetInt("SelectedCar"); foreach (GameObject car in cars) car.SetActive(false); cars[currnetCarIndex].SetActive(true); } }
@Apricot0034
@Apricot0034 3 жыл бұрын
using UnityEngine; public class ShopManager : MonoBehaviour { public GameObject[] CarModels; public int currnetCarIndex; // Start is called before the first frame update void Start() { currnetCarIndex = PlayerPrefs.GetInt("SelectedCar"); foreach (GameObject car in CarModels) car.SetActive(false); CarModels[currnetCarIndex].SetActive(true); } // Update is called once per frame void Update() { } public void ChangeNext() { CarModels[currnetCarIndex].SetActive(false); currnetCarIndex++; if (currnetCarIndex == CarModels.Length) currnetCarIndex = 0; CarModels[currnetCarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedCar", currnetCarIndex); } public void ChangePre() { CarModels[currnetCarIndex].SetActive(false); currnetCarIndex--; if (currnetCarIndex == -1) currnetCarIndex = CarModels.Length -1; CarModels[currnetCarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedCar", currnetCarIndex); } }
@Apricot0034
@Apricot0034 3 жыл бұрын
I made these edits and now the object I want comes to the scene (have a nice day)
@ntb1132
@ntb1132 2 жыл бұрын
Will this still show the selected car in the level if I dont directly go to the level scene after choosing a car
@GDTitans
@GDTitans 2 жыл бұрын
Yeah we've added the logic to select the car in the level
@Szogun_
@Szogun_ Жыл бұрын
Can you please make tutorial how yo upgrade speed/health/damage? Its so hard to find tutorial for this and my game need it.
@Szogun_
@Szogun_ Жыл бұрын
Saving upgrades using playerprefs
@md_rofique
@md_rofique Жыл бұрын
I am having issues, though my shop is working and next and back button works, but when I click play, the game always selects index 0, and as a result only the first model is loaded
@GDTitans
@GDTitans Жыл бұрын
Check out the new detailed video about the shop system kzbin.info/www/bejne/lanNpK2cjaeNm9E There is a second part under description
@ogrenmedengecme8652
@ogrenmedengecme8652 3 жыл бұрын
😍😍😍
@gameopedia01
@gameopedia01 2 жыл бұрын
Hi GDTitans, i have one problem. my game contains touch controls button. if i select a car out of other cars then i have to reassigne the functions to the event trigger buttons for that particular car. How to solve this ? Help
@maxshinobi6092
@maxshinobi6092 2 жыл бұрын
Hey, if you are using EventTrigger to trigger functions on buttons, then you might wanna do this: public void NextCar(bool next) { if (next) { //code } } public void PreviousCar(bool previous) { if (previous) { //code } } Then in the EventTrigger add PointerClick as an Event Type, hit +, drag the script to the specified box, assign the function and finally check the box (because our function is taking a parameter of bool). You should be good after this
@gamedevelopment8556
@gamedevelopment8556 Жыл бұрын
i just found your channel but i don't understand one thing here you showed different characters that we can select by purchasing but where is the full tutorial of this?
@GDTitans
@GDTitans Жыл бұрын
I have used a standard asset from the unity asset store. So, you could add a shop system to any game but if you want to see how I've added a shop to my 2d platfomer from scratch watch this video kzbin.info/www/bejne/lanNpK2cjaeNm9E
@waifu_sucker2947
@waifu_sucker2947 3 жыл бұрын
when going to the next level it loads both of the objects (in your video cars) how to fix it anyone please help.
@dighidon7207
@dighidon7207 Жыл бұрын
Hi mate! Beautiful tutorial as usual, been following the Wheel Runner and I ended up here, so everything working fine but when I do select another player from the menu it will not assign automatically the 'Animator Controller' in the PlayerController script so it will not perform the animations.. I have been searching around forums and stuff to get it on my own but I don't understand how to do that. I would appreciate your help, thanks a lot for everything you do for the community!
@GDTitans
@GDTitans Жыл бұрын
I created a prefab for each character (with its animator controller, 3d model, and scripts..) then added a script to instantiate the selected character(prefab).
@dighidon7207
@dighidon7207 Жыл бұрын
@@GDTitans Thanks GD! So basically the script PlayerController now should go on the player itself then I make a prefab and how would look a script to instantiate the prefab? As I kinda tried make it work with changing the 'Animator animator;' to 'animator = GameObject.FindWithTag("Player")' into the 'start' function but it doesn't do any good :)) I thought that like that animator would be any object that has the tag player, same problem I have with the camera as in the script you made in the tutorial I have to select the player from the properties so once the player changes the camera would stay still.. I am really new to this so apologies if some things sound even stupid :)) I appreciate your time!
@dighidon7207
@dighidon7207 Жыл бұрын
@@GDTitans Ok I think I sorted the character selection by creating the prefabs for each one and in the 'CarContainer' I've added directly those prefabs and it seems to be working, now I am trying to figure out how to make the camera understand that the player has been changed and to follow the new one.. :))
@dighidon7207
@dighidon7207 Жыл бұрын
Ok another update ahaha I've sorted the cameras by creating a CameraHandler inside the player with a Camera attached and adding the CameraController to each CameraHandler so any player I am choosing from beginning it doesn't affect the cameras :)) Idk if it's the right way but it's working :)) Last problem I am going really crazy to solve is the TileManager that needs a PlayerTransform to know when to spawn new tiles :)) Maybe I'll figure it out until you see this message but I try anyway ahah sorry for to bother!
@TheKING-tm9so
@TheKING-tm9so Жыл бұрын
Hello, i faced the same problem, if you solved it can you please tell me how you did it, I'm a beginner too
@DavidThemanoy
@DavidThemanoy 3 жыл бұрын
That didn't 100% worked for me. The script worked, but I went to the main menu after selecting the car. After the main menu, selecting the track, the first car is playable, not the selected car. Anyone can help me?
@kodandaraochellapilli6212
@kodandaraochellapilli6212 7 ай бұрын
It is not clear and you did not show us everything step by step. Please let me know where to find the source code?
@lilianchavessilva1877
@lilianchavessilva1877 Жыл бұрын
🤜🤛
@yassenbel7733
@yassenbel7733 2 жыл бұрын
tanks i have tow player in scene for 2d game can you help me
@issambenhassine2016
@issambenhassine2016 Жыл бұрын
tounsi hhh 3raftek mi accent wath7a 3ale5er ya3tik sa7a 3al tutoriel
@GDTitans
@GDTitans Жыл бұрын
بارك الله فيك وجزاك خير الجزاء
@pedro-ms6te
@pedro-ms6te 3 жыл бұрын
Hey! Can you help me? I have an issue
@suryaprakash9083
@suryaprakash9083 7 ай бұрын
Hii Sir your car selection videos tutorial is very nice But I have a problem I want to unlock 🔓 All vehicles at once With Signal button click and also save it how Can I do that please reply me Sir thank you
@mohammadumer2668
@mohammadumer2668 2 жыл бұрын
please show the select button code
@KBforJesusChrist
@KBforJesusChrist Жыл бұрын
I wish I could add this to my multiplayer game but I don't know how to
@Xmsnjeje
@Xmsnjeje 3 жыл бұрын
When I close the game and open it, everything goes back to the way it was, I did everything the same.
@Geographyball1
@Geographyball1 3 жыл бұрын
the video is top quality but i didnt understood how to save coins in your tuorial on coins you just pick them up not save them
@karlomarkovic3777
@karlomarkovic3777 3 жыл бұрын
I made the button to go to the next one and the previous one but it's not working. Any idea why?
@karlomarkovic3777
@karlomarkovic3777 3 жыл бұрын
Here is the script: using System.Collections; using UnityEngine; public class ShopManager : MonoBehaviour { public int currentCarIndex = 0; public GameObject[] carModels; void Start() { currentCarIndex = PlayerPrefs.GetInt("SelectedCar", 0); foreach (GameObject car in carModels) car.SetActive(false); carModels[currentCarIndex].SetActive(true); } // Update is called once per frame void Update() { } public void ChangeNext() { carModels[currentCarIndex].SetActive(false); currentCarIndex++; if (currentCarIndex == carModels.Length) currentCarIndex = 0; carModels[currentCarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedCar", currentCarIndex); } public void ChangePrevious() { carModels[currentCarIndex].SetActive(false); currentCarIndex--; if (currentCarIndex == -1) currentCarIndex = carModels.Length - 1; carModels[currentCarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedCar", 0); } }
@GDTitans
@GDTitans 3 жыл бұрын
Hi, The last line it needs to be PlayerPrefs.SetInt("SelectedCar", current CarIndex); Make sure to add the onclick function and assign your carModels array.
@karlomarkovic3777
@karlomarkovic3777 3 жыл бұрын
@@GDTitans I changed it but it still doesn't work. The buttons are connected.
@Geographyball1
@Geographyball1 3 жыл бұрын
Hey @GDTitans my camera wont follow my other player i tagged it with Player
@cubertastic971
@cubertastic971 2 жыл бұрын
I figured out a way however I'm not completely sure if it's optimal but it works. Ok so first thing I did was I declared another variable for the 2nd character as public Transform target2 in the camera controller script. then, in the start function, there's a line of code for the offset like this: offset = transform.position - target.position I then subtracted the target2.position so now it's: offset = transform.position - target.position - target2.position then, in the FixedUpdate method, the first line used to be: Vector3 newPosition = new Vector3(transform.position.x, transform.position.y, offset.z + target.position.z); but then I changed it to Vector3 newPosition = new Vector3(transform.position.x, transform.position.y, offset.z + target.position.z + target2.position.z); You can then add more to the mix if you want to. Hope this helps
@aqsaarif124
@aqsaarif124 3 жыл бұрын
Kindly tell me start button code
@dashsoon7415
@dashsoon7415 2 жыл бұрын
How to save coin amount in shop scene
@gamesmunch
@gamesmunch 3 жыл бұрын
please make a tutorial on Cube Surface vodoo top game
@CodingSucks
@CodingSucks 3 жыл бұрын
Bro.. I am unable to change the cost in UI of the game
@GDTitans
@GDTitans 3 жыл бұрын
Update the ui text each time you buy an item using CoinsText.text = "Coins: "+ PlayerPrefs. GetInt(0,"numberOfCoins"):
@CodingSucks
@CodingSucks 3 жыл бұрын
@@GDTitans actually... I was saying.. That when I purchase the car... The cost do not change in the UI.. It remains same.. But when I go and play the game.. The cost is deducted..
@nitesholi8645
@nitesholi8645 2 жыл бұрын
when I select new car... the camera wont follow
@GDTitans
@GDTitans 2 жыл бұрын
I think you need to change its tag to "Player"
@JoaoVitor-wg7xk
@JoaoVitor-wg7xk 2 жыл бұрын
Alguém mais esta tendo problemas com a câmera ? ela não fixa no personagem! Is anyone else having problems with the camera? she doesn't fixate on the character!
@technocraftSTUDIO
@technocraftSTUDIO Жыл бұрын
Camera follows the tag "player". Change it and it will work
@kamalaswal5970
@kamalaswal5970 3 жыл бұрын
bro what about start button
@GDTitans
@GDTitans 3 жыл бұрын
Watch this video kzbin.info/www/bejne/iWbIoGiZe9BoZ7c
@udaykant
@udaykant 2 жыл бұрын
My car is damaged when it spawn
@jeffreyogbonnaya7682
@jeffreyogbonnaya7682 3 жыл бұрын
hi, sir i have a problem. whenever i select a model, and pressplay button the index number automatically changes to 0 no matter what i do. i really need your help sir and would be greatfull if you hep me. anyone too can help please. i will accept help from anyone please.
@jeffreyogbonnaya7682
@jeffreyogbonnaya7682 3 жыл бұрын
this is my shopmanager script using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShopManager : MonoBehaviour { // Start is called before the first frame update public int currentBallIndex; public GameObject[] ballModels; void Start() { currentBallIndex = PlayerPrefs.GetInt("SelectedBall", 0); foreach (GameObject ball in ballModels) ball.SetActive(false); ballModels[currentBallIndex].SetActive(true); } // Update is called once per frame void Update() { } public void ChangeNext() { ballModels[currentBallIndex].SetActive(false); currentBallIndex++; if (currentBallIndex == ballModels.Length) currentBallIndex = 0; ballModels[currentBallIndex].SetActive(true); PlayerPrefs.GetInt("SelectedBall", currentBallIndex); } public void ChangeBack() { ballModels[currentBallIndex].SetActive(false); currentBallIndex--; if (currentBallIndex == -1) currentBallIndex = ballModels.Length -1; ballModels[currentBallIndex].SetActive(true); PlayerPrefs.GetInt("SelectedBall", currentBallIndex); } }
@jeffreyogbonnaya7682
@jeffreyogbonnaya7682 3 жыл бұрын
this is my ball selector script using System.Collections; using System.Collections.Generic; using UnityEngine; public class BallSelector : MonoBehaviour { public int currentBallIndex; public GameObject[] ball; void Start() { currentBallIndex = PlayerPrefs.GetInt("SelectedBall", 0); foreach (GameObject ball in ball) ball.SetActive(false); ball[currentBallIndex].SetActive(true); } }
@jeffreyogbonnaya7682
@jeffreyogbonnaya7682 3 жыл бұрын
though i think the problem is because i have a level selection in my game and i have to select a level before i can play the game. but even when i remove the level selection, the problem is still there please help me sir
@jeffreyogbonnaya7682
@jeffreyogbonnaya7682 3 жыл бұрын
sorry for the disturbance sir. incase u have the same problem as i, just delete the using using System.Collections.Generic;
@ApricotV2
@ApricotV2 3 жыл бұрын
Dude, I can help you in two hours.
@Kabeer.
@Kabeer. 3 жыл бұрын
Hey Developer please respond to this I really need help. Or if anyone else could help me that would be very apreciated. So my problem is that no matter what I do it is keep on selecting the first car.
@Kabeer.
@Kabeer. 3 жыл бұрын
This is my shopmanager script using System.Collections; using UnityEngine; public class ShopManager : MonoBehaviour { public int currentcarIndex = 0; public GameObject[] carModels; // Start is called before the first frame update void Start() { currentcarIndex = PlayerPrefs.GetInt("SelectedTank", 0); foreach (GameObject car in carModels) car.SetActive(false); carModels[currentcarIndex].SetActive(true); } // Update is called once per frame void Update() { } public void ChangeNext() { carModels[currentcarIndex].SetActive(false); currentcarIndex++; if (currentcarIndex == carModels.Length) currentcarIndex = 0; carModels[currentcarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedTank", 0); } public void ChangePrevious() { carModels[currentcarIndex].SetActive(false); currentcarIndex--; if (currentcarIndex == -1) currentcarIndex = carModels.Length - 1; carModels[currentcarIndex].SetActive(true); PlayerPrefs.SetInt("SelectedTank", 0); } }
@Kabeer.
@Kabeer. 3 жыл бұрын
and this is my car selector script
@Kabeer.
@Kabeer. 3 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CarSelector : MonoBehaviour { public int currentcarIndex = 0; public GameObject[] cars; // Start is called before the first frame update void Start() { currentcarIndex = PlayerPrefs.GetInt("SelectedTank", 0); foreach (GameObject car in cars) car.SetActive(false); cars[currentcarIndex].SetActive(true); } }
@Kabeer.
@Kabeer. 3 жыл бұрын
my guess is that there is something wrong in the shopmanager because it switches cars in the buying scene but then whenever I switch back to my main screen its still the same car its always been.
@GDTitans
@GDTitans 3 жыл бұрын
In the last line of the functions ChangeNext , ChangePrevious you need to use PlayerPrefs.SetInt("SelectedTank", currentcarIndex) not 0 because you are always selecting the first tank
@md_rofique
@md_rofique Жыл бұрын
Please help
@yqpan7061
@yqpan7061 3 жыл бұрын
CarSelector using System.Collections; using System.Collections.Generic; using UnityEngine; public class NewBehaviourScript : MonoBehaviour { public int currentCarIndex = 0; public GameObject[] cars; void Start() { currentCarIndex = PlayerPrefs.GetInt("SelectedCar", 0); foreach (GameObject car in cars) car.SetActive(false); cars[currentCarIndex].SetActive(true); } }
@Geographyball1
@Geographyball1 2 жыл бұрын
i didnt understood how to save coins in your tuorial on coins you just pick them up not save them
@technocraftSTUDIO
@technocraftSTUDIO Жыл бұрын
Use playerprefs
@Geographyball1
@Geographyball1 Жыл бұрын
@@technocraftSTUDIO you are very late
@technocraftSTUDIO
@technocraftSTUDIO Жыл бұрын
@@Geographyball1 I thought no one has answered you, now I know why. though no worry brother
@TheKING-tm9so
@TheKING-tm9so Жыл бұрын
@@technocraftSTUDIO hey, i'm a beginner i want the scoreand high score to show up on gameover panel if you can help plz
@technocraftSTUDIO
@technocraftSTUDIO Жыл бұрын
@@TheKING-tm9so i need to see my code , let me know you, wait
@shankarshivam1877
@shankarshivam1877 3 жыл бұрын
Its been more than 2 months, Ads are showing but Admob earning is zero Dollar, In first month Revenue generated about 0.5 dollars.Impression and click are good but no revenue. Please Help.
@Xmsnjeje
@Xmsnjeje 3 жыл бұрын
When I close the game and open it, everything goes back to the way it was, I did everything the same.
Simple Shop System in Unity -  (Part 2)
17:36
GDTitans
Рет қаралды 18 М.
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,3 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 178 МЛН
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 123 МЛН
Character Selector in Unity
29:20
Muddy Wolf
Рет қаралды 11 М.
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 506 М.
How to make a simple Shop in Unity
14:16
Zyger
Рет қаралды 59 М.
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
How to make a Dialogue System in Unity
16:19
Brackeys
Рет қаралды 912 М.
Simple Physics Based Plane Controller in Unity
28:43
b3agz
Рет қаралды 37 М.
Unity Tutorial - Simple Character Selection System
5:30
RumpledCode
Рет қаралды 83 М.
Unity Basics - Waypoint Path system in Unity Part 1
31:57
MetalStorm Games
Рет қаралды 37 М.