For anyone having trouble selecting InventoryUI in the last step, make sure you attached it to the text!!! Thank you, this tutorial was very helpful!
@glebkozlov16032 жыл бұрын
Man that was delightful. After all those rushy tutorials this series is a breath of fresh air. Thank you!
@KetraGames2 жыл бұрын
Thanks very much for this 😊
@attenurmi9362 жыл бұрын
This series is clear, simple concept, well planned and fun to follow. Thank you! I'm really looking forward on seeing more of these videos!
@KetraGames2 жыл бұрын
Thanks for this great comment 😊
@jatsparrow2 жыл бұрын
Thank you for this beginner friendly tutorial. I'm waiting for your next tutorial.
@KetraGames2 жыл бұрын
Great to hear, thank you 😊
@marcobarberio6910 Жыл бұрын
I'm having problems with the last part in which we should see the number of items collected. It doesn't change. In addition, inside Inspector -> yer Inventory (Script) -> InventoryUI, UpdateDiamondText doesn't appear, why? (I followed all the steps and copied the codes)
@thesilentwisp2 жыл бұрын
This was super helpful. Didn't know about the events system!
@KetraGames2 жыл бұрын
Glad it was useful 😊
@muscatalexj Жыл бұрын
How would you reference the number of collected items in another script? Im trying to make it so that once i pickup 10 an achievement pops
@samirehman4565 Жыл бұрын
finally someone who didn't use destroy function on collectable.
@gabryelhuneault18012 жыл бұрын
I figured it out the text issue but I have another issue. The updated playerinventory script works fine but the subscriber list doesn't appear or show up. Please help! ASAP!
@KetraGames2 жыл бұрын
Hi, I think this will be a limitation with the version of Unity you're using not supporting generic events. As an alternative you can make the event a plain event e.g. public UnityEvent OnDiamondCollected; Then you can select the PlayerInventory in the Inspector when wiring up the event. Hope that helps 😊
@qistinaalia4493 Жыл бұрын
Hi I cant seem to find the update diamond text method, can you help me?
@KetraGames Жыл бұрын
Hi, the full script can be found here - dotnetfiddle.net/Rzs92c Hope that helps 😊
@tjorloski19612 жыл бұрын
I'm also getting that bug where the Unity event is not showing the Update player inventory thing. it was working fine on 2020.3 , but on my new project in 2021.3 it isn't working
@KetraGames2 жыл бұрын
Hi, that's strange. I've upgraded the project to 2021.3 and it seems to work fine. As an alternative, you can make the event a plain event e.g. public UnityEvent OnDiamondCollected; Then you can select the PlayerInventory in the Inspector when wiring up the event. Hope that helps 😊
@guruprasadh_j Жыл бұрын
Most clear video to understand;
@KetraGames Жыл бұрын
Great to hear this, thanks 😊
@MRBREAD1709Ай бұрын
when i did it the dimond tex and image did't show on the screen
@nimomaniachannel2 жыл бұрын
this was so clear and its recent. im subbing
@KetraGames2 жыл бұрын
Thank you 😊
@protophase Жыл бұрын
Well made tutorial, easy to follow. What if you wanted to play a sound whenever you collect a gem?
@michelec11782 жыл бұрын
Thank you, please more tutorials 😊 ,very good tutorials!
@KetraGames2 жыл бұрын
Glad you're finding them useful 😊
@galberger39379 ай бұрын
Hi. can you show how to collect bullets, when the player press E with a canvas that shows the corrent amount of the bullets?
@gabryelhuneault18012 жыл бұрын
I can't use TMPro in my unity project because I'm using unity 5.6.7f1 and textmeshpro isn't available. Please help
@gabryelhuneault18012 жыл бұрын
Cancel that comment
@豆豆開心18 күн бұрын
I followed the code all they way even copy and paste it but on the last step UpdateDiamondText did not show up
@zalatanypl98442 жыл бұрын
Simply Genius! Thx a lot!
@KetraGames2 жыл бұрын
Thanks fro this comment 😊
@izzu7641 Жыл бұрын
Hello , i have 3 object to collect and what should i do to collect it in order if 1 is not collected 2 is collected,then of 1 is collected and 2 collected?
@potatojann2332 жыл бұрын
Goshh😭 thank you so much. I totally appreciate it.
@KetraGames2 жыл бұрын
👍😊
@sherlockholmes374 Жыл бұрын
Hi there! What if I want the diamonds to spawn randomly during the day?
@aryanpatankar8168 Жыл бұрын
Thanks! it worked for my mobile game!
@Wraith4444 Жыл бұрын
TYSM IT HELPED MY GAME SOO MUCH
@KetraGames Жыл бұрын
Great to hear, thanks 😊
@redwes7022 жыл бұрын
Hello, I have everything setup like in the video but when my character walks into the diamonds it does not collect them but they are solid instead and it just collides. It seems like a problem in my diamond script detecting player collision but everything is setup as in the video so I'm not sure what the issue is?
@kabhes90402 жыл бұрын
I had this problem a few minutes ago one child component in my diamond had a "collider" that didn't had "trigger" checked on.
@jkair53522 жыл бұрын
does anyone know how to get a "you win" page when the player have collected 10 items?
@paulpopSignatur11 ай бұрын
If you figure it out let me know I'm looking for the same question
@davidkunle15122 жыл бұрын
Hi great tutorial I'm just wondering how do I make it so when you collect a number of items it brings you to a new scene like a game over scene.
@KetraGames2 жыл бұрын
Hi, thanks. You could add another script that contains a method that checks the number of items collected and then executes your desired action. Then you could wire up the collected event to this new method. Hope that helps 😊
@spongehead932 жыл бұрын
@@KetraGames Is there any chance we could get some code written out for this method to check the number of items? I'm trying to do something similar but I keep getting an error saying that the playerInventory is non-invocable. Here's the code I've written below: public class PhotoAppear : MonoBehaviour { PlayerInventory playerInventory = GetComponent(); void Start() { gameObject.SetActive(false); } // Update is called once per frame public void Update() { if (playerInventory.NumberOfPhotos() == 5) { gameObject.SetActive(true); } return; } } As well, thank you for this tutorial, what it covered was very easy to follow and understand.
@muscatalexj Жыл бұрын
Did you ever figure this out?@@spongehead93
@muscatalexj Жыл бұрын
How would you write that in code?@@KetraGames
@paulpopSignatur11 ай бұрын
Yes I'm looking for the same tutorial nobody has it😢😢
@ani-gamer3202 жыл бұрын
Thanks for this tutorial ❤️❤️
@KetraGames2 жыл бұрын
👍😊
@NotSoSeriousGaming2 жыл бұрын
Thank you for such a great guide! How would you carry the gem display onto another scene? I tried the same thing but nothing displayed
@KetraGames2 жыл бұрын
Hi, good question. There are a few ways you can pass data between scenes 1. You can use PlayerPrefs to save and load data between scenes - docs.unity3d.com/ScriptReference/PlayerPrefs.SetInt.html 2. Game Objects can survive between scenes if you set DontDestroyOnLoad so this may be a possibility - docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html 3. Another option is to store the data in a ScriptableObject which will then persist across scenes - docs.unity3d.com/Manual/class-ScriptableObject.html Hope that helps 😊
@NotSoSeriousGaming2 жыл бұрын
@@KetraGames wow you didn't hold back i really appreciate this.. you are amazing! Keep up the great work !
@cropoxz2 ай бұрын
When I walk over the "diamonds" they don't get collected :/ anyone know why?
@nega-guy Жыл бұрын
Hi, I have a problem. I have all the scripts copied and put into the correct objects but there's something wrong. When I go to my character the Player Inventory script doesn't show the thing where I can select the function of OnDiamondCollected. Plus, when I try to test the game and grab the collectables it just throws me this error: "NullReferenceException: Object reference not set to an instance of an object PlayerInventory.DiamondCollected () (at Assets/PlayerInventory.cs:13) Diamond.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Diamond.cs:13)" By the way, I'm using Unity 2019.4.40f1 Personal. Maybe that has something to do? If you can help I'd thank you a lot.
@Manofthebean2 жыл бұрын
thank you this was a big help in my game!!
@KetraGames2 жыл бұрын
Great to hear this 😊
@jameszchan60962 жыл бұрын
How can I make the item only be pickd up whn a player is holding a certain key?
@KetraGames2 жыл бұрын
Hi, you could store a reference to the diamond in the OnTriggerEnter method. Then you could remove the reference in the OnTriggerExit method. Then in Update you could check for the button press and pick up the diamond if the reference is not null. Hope that helps 😊
@ev9787 Жыл бұрын
@@KetraGames hi, i would love to do this for my game, but it doesn't make sense to me, could you explain it in more detail, im a beginner
@Cricketdude69 Жыл бұрын
great tutorial!
@Bornholm-Roenne2 ай бұрын
On Diamond Collected PlayerInventory the update name you said I cant find it. TextmeshProUGui.UpdateFontAsset is the one I can pick?
@KetraGames2 ай бұрын
Hi, I'm not sure why it wouldn't be showing. Have you compared your script to the one here dotnetfiddle.net/Rzs92c
@alperturan1677 ай бұрын
Another perfect tutorial by Ketra Games :) Thank you very much. May I ask a question: I've got two characters in the game but player can use both of them by swaping. I assigned the PlayerInventory script both of them and it works, BUT once the character#1 collects some diamonds and if I swap to the character#2 and collect any diamond then die diamond collection amount RESETS to 1. It seems Unity or the script keeps the amount for each character seperately, which is fine btw, but 1st Question= how can I show the amount of diamond collection amount of each character on canvas seperately? 2nd Question = how can I show the total diamond collection amount (without resetting) on the same canvas / text area? Many Thanks !
3 ай бұрын
I love u so much thank you for helping this helped for my project
@KetraGames3 ай бұрын
Great to hear, thank you 😊
@JPMjeremy Жыл бұрын
Amazing video!
@aleksandraaleksandra79342 жыл бұрын
At the very beginning: big hugs to you💚! You do wonderful tutorials for beginners, I learn a lot from your videos. Thank you! I used this video to add scripts to an existing project that I have been working on for a while. I already have a canvas for Game Over. I did what you did in this video, no bugs, player can collect diamonds but unfortunately nothing is charged on the canvas. I watched the tutorial again and I don't know where the error may be. I know it's hard to answer something "out of the head", but maybe someone has an idea?🙄
@KetraGames2 жыл бұрын
Hi, glad you're finding the videos useful. Have you set up the event handler in the Inspector to update the canvas when a diamond is collected? If so, it might be worth adding a Debug.Log line in the method you're calling from the event handler, to make sure it is getting called. Hope that helps 😊
@redna36992 жыл бұрын
What simple anda wonderful tutorial right there, But I have question. So how to make value of the diamond collected to somewhat larger than 1?
@KetraGames2 жыл бұрын
Thanks 😊 If you wanted the diamond to increase the count by more than 1 you could change the line in the PlayerInventory. So rather than NumberOfDiamonds++; you could do NumberOfDiamonds+= 10; Hope that helps 😊
@redna36992 жыл бұрын
@@KetraGames it worked!!! Thank you very much
@frostymug31232 жыл бұрын
Great tutorial. I have encountered an issue however with the last step ... public UnityEvent OnPickUpCollected; is not exposed in the inspector even with adding [SerializeField]. From what I gather this is a unity bug, any thoughts on a work around?
@KetraGames2 жыл бұрын
Hi, I can't think of why it wouldn't be visible. Are you seeing any errors in the Console window? If you still can't get it to work, try copying the script form here - dotnetfiddle.net/Rzs92c Hope that helps 😊
@frostymug31232 жыл бұрын
@@KetraGames Thank you for the quick response! No errors in console. When researching this issue I found lots of posts claiming this was a unity bug issue with exposing unity events in the inspector. Some suggested you could get around this issue using [System.Serializable]. The example is: "I have found the way. first you have to define your own event type (which is just a basic public class). however the custom event type must inherit from UnityEvent, like so." [System.Serializable] public class myFloatEvent : UnityEvent{} "then you can make variables from it, like so." [SerializeField] public myFloatEvent onChangeEvent; I'm just not sure how to refactor this to work with your example.
@KetraGames2 жыл бұрын
I've had a look into this and it seems this was an issue on earlier versions of Unity. What version are you using?
@Samael-lp3nk2 жыл бұрын
Hi thanks for the great tutorials. I'm getting the same error at this point also, i have the latest versions of unity and visual studio my character has [SerializedField] On a third person shooter controller. Not sure if this would have any effect?!🤷♂️
@vimalv23122 жыл бұрын
Where to add this scripts in first person play ?!
@corrohsivegaming70772 жыл бұрын
Lovely video! The only part I am wondering is how would I add a sound to when I collect a diamond?
@KetraGames2 жыл бұрын
Hi, to play a sound you need to have an audio source. Because the diamond is disabled when it's collected, it won't be able to play the sound itself. Therefore, you will need to add an audio source to the Player object. You can then play as sound using AudioSource.PlayOneShot - docs.unity3d.com/ScriptReference/AudioSource.PlayOneShot.html Hope that helps 😊
@alejandraalcocer98572 жыл бұрын
@@KetraGames but it doesnt work if its collider other, how do you connect it? pls help unu
@CCLawhon Жыл бұрын
@@alejandraalcocer9857 @KetraGames and anyone else looking to add sound to these collectibles...I found a solution :) I made a tutorial here: kzbin.info/www/bejne/o3KchoStn96eps0 ...basically just add a parent to your diamond and give that its own bigger collider, audio source, and the "Play Sound on Enter" script in the tutorial :)
@tigranavagyan5922 Жыл бұрын
Thank you VERY MUCH for this video👍
@KetraGames Жыл бұрын
👍😊
@bonse20002 жыл бұрын
witch ipnut are u using old or new? its dowsnt work for me i havent errors on scripts bad my chr dsnt collect the diamonds
@KetraGames2 жыл бұрын
Hi, this is using the old input system. We're planning a video showing how to upgrade to the new system at some point in the future.
@bonse20002 жыл бұрын
@@KetraGames cant wait for that thank you
@DannyDoux Жыл бұрын
Hey, first of all i love your tutorials on unity, but i've been watching countless tutorials, blog posts and The unity guide and can't find anything about persistent collectable couter, how can i make it that when i collect 7 collectables in one level that i start the next one with 7?
@KetraGames Жыл бұрын
Hi, you would need to persist this between scenes. There are several options to do this. You can use a static variable, Unity's Player Prefs, or you can serialise to disk and load it back in again. Hope that helps 😊
@fernandoabalmedina6571 Жыл бұрын
@@KetraGames hi i want that when i get to 10 diamonds the player go to next level scene 2, how i can make that happen?
@WornTraveler2 жыл бұрын
Thanks for all the dope videos! 🙏 Keep it up, they are very helpful and everything is well explained, being a newb I dig that lol 😂
@KetraGames2 жыл бұрын
Thanks for this comment 😊
@Lerde2 жыл бұрын
Great video...what if i want diamonds to be collected for example 20 and then congratulations on passing a level?
@KetraGames2 жыл бұрын
Hi, you would need to create another script to do this. You could still hook up the diamond collected event to this new script but check if the total has reached 20 before making the text visible. Hope that helps 😊
@shang_psycho74142 жыл бұрын
This helped, thanks!
@KetraGames2 жыл бұрын
👍😊
@shang_psycho74142 жыл бұрын
@@KetraGames It still worked even though I wasn't using diamonds as the object.
@shang_psycho74142 жыл бұрын
@@KetraGames Do you know how to make it so that when all the items are collected, a scene changes or something?
@KetraGames2 жыл бұрын
@@shang_psycho7414 Hi, you would need to keep track of how many collectables are still active in the scene. Once you reach zero then you can trigger the scene change.
@shang_psycho74142 жыл бұрын
@@KetraGames Ok. If I can't figure out how to do that, I'll try something else. Thanks for the advice.
@BjornBrnk8 ай бұрын
Please help! This was an awesome tutorial, but I can't find 1 thing on the internet that explains how to load next scene if all objects are collected!!!
@Darkwar90992 жыл бұрын
Nice vid it works great on my own game
@KetraGames2 жыл бұрын
Thanks, good to hear this 😊
@HansChristian-bj2pt2 жыл бұрын
Great tutorials. However im runing into an error with this one, even if i copy your code from the fiddle link. ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'PlayerInventory'. I get this error when i implement the last steps. Everything works fine up till then. The gems gets picked up and removed but at soon as i want to send the number of gems to the UI i get the error. And only when i attempt to pick up the gems.
@KetraGames2 жыл бұрын
Hi, can you check that when you trigger the event in the PlayerInventory script, that you're passing through 'this' OnDiamondCollected.Invoke(this); That should pass the PlayerInventory through to the UI script. If that doesn't work you could try changing the event to just be a general event public UnityEvent OnDiamondCollected; Then when you wire up the event in the Inspector, there should be an extra slot for the PlayerInventory that you can drag the Player object into. Hope that helps 😊
@MetaDataAutomation2 жыл бұрын
Hiya, Thanks for the nice video, was easy to follow. Bit of a plot twist for me though - I'm using 2D so maybe that's the problem. Basically I have a fireball that comes down and I want my character to collect it. The fireball has a rigidbody, circular collider and bouncy physics. When it hits my dragon it doesn't get collected - any ideas?
@KetraGames2 жыл бұрын
Hi, have you marked the collider as a trigger?
@muhammadjonyangiboyev9517 күн бұрын
thanks
@KetraGames6 күн бұрын
👍😊
@muhammadhabibulloh15962 жыл бұрын
please help me, I have followed the script but the diamonds don't disappear when they are taken 🙏🏻
@KetraGames2 жыл бұрын
Hi, does the diamond count on the screen go up even though they don't disappear? Are there any errors in the console?
@vmbrine2 жыл бұрын
@@KetraGames Hi ! I have the same problem than him, my character passes through the collectibles and it does send me an error 😢
@vmbrine2 жыл бұрын
And the « is Trigger » is clicked on so I really don’t know where the problem is coming from
@KetraGames Жыл бұрын
@vmbrine You said it does send you an error? Could you send the details of the error if there is one. Otherwise, it's a matter of debugging to see where the issue is. You can either put breakpoints in the code and step through if you know how to do that. Or you can add Debug.Log lines in to see where it gets to before it fails.
@damontebooze4869 Жыл бұрын
bruh I got an error something about it not containing a defintion
@solid9643 Жыл бұрын
Same
@lewid5409 Жыл бұрын
Did you solve the problem?
@terablue802 жыл бұрын
HIIII! Amazing tutorial! Do you think this is doable on an AR game? I'm trying to figure out if there's any possibility to collect an AR element and put it into an inventory (ideally on click as it is an android app) yet I didn't manage to find any tutorial on this topic :( Any advice? Thanks!
@KetraGames2 жыл бұрын
Hi, sorry I've not looked into AR functionality in much detail. I'd have thought it was possible though
@darkprinc32842 жыл бұрын
life savior
@KetraGames2 жыл бұрын
Great to hear 😊
@tangaroranguzzikeirb.9264 Жыл бұрын
how to collect the diamond in order like in diamond1 diamond 2 diamond 3 , if diamond 1 one is collected you cannot collect the diamond 2 and diamond 3.
@luliii123 Жыл бұрын
Super helpful 🤩
@KetraGames Жыл бұрын
Great to hear 😊
@PrincedeepKaur-f9n Жыл бұрын
Thankyou so much.
@KetraGames Жыл бұрын
👍😊
@davisardians84112 жыл бұрын
great tutorial. can i request tutorial "trigger a dialog with npc"?
@KetraGames2 жыл бұрын
Thanks for the suggestion. We'll add it to the list of future videos 😊
@azzamrashid3726 Жыл бұрын
4:25 //use override
@KBforJesusChrist2 жыл бұрын
How can I make an item spawn after collecting all objects (diamonds)
@KetraGames2 жыл бұрын
Hi, you would need to keep track of how many diamonds are left in the scene. You could write a script that gets the count of diamonds in the scene in the Awake method. Then subscribe to the diamond collected event and decrease this count each time. Once you reach zero you can initialise the object you want. Hope that helps 😊
@KBforJesusChrist2 жыл бұрын
@@KetraGames it's like i want an item to spawn at a certain location after a player collects 7 diamonds i made a parkour game that you can only win by collecting a special item but i want that item to only spawn when you collect a specific amount of gems . I'm a beginner with no knowledge of coding but I'm halfway done with my game I'm making with just tutorial
@hballamco2 жыл бұрын
A beginner question, in the "InventoryUI" script, why did you put argument for the "UpdateDiamondText" method? What was the source of that argument to make the method work? Thank you,
@KetraGames2 жыл бұрын
Hi, the UpdateDiamondText uses the PlayerInventory parameter to get the number of diamonds that have been collected. playerInventory.NumberOfDiamonds.ToString(); This is passed through when the event is invoked from the PlayerInventory. OnDiamondCollected.Invoke(this); In this case 'this' refers to the PlayerInventory invoking the event. Hope that makes sense 😊
@hballamco2 жыл бұрын
@@KetraGames I see, thanks a lot
@Rovtar_2 жыл бұрын
How to move box collider?
@KetraGames2 жыл бұрын
Hi, the box collider position is linked to the transform of the object it is attached. You can change the center position to offset it however you want. Hope that helps 😊
@mxbshr4276 Жыл бұрын
my fpc character just runs straight through the gems, i followed your code exactly and i cannot get it to work
@KetraGames Жыл бұрын
Hi, do you see any errors in the console window?
@alfredb.44852 жыл бұрын
Perfect! "thx you";
@KetraGames2 жыл бұрын
Thanks 😊
@dimassuhada12302 жыл бұрын
Thank uu
@KetraGames2 жыл бұрын
👍😊
@nimomaniachannel2 жыл бұрын
QUESTION: Are the public class names just the name of the C# script. For example, public class PlayerInventory : Monobehaviour; because the filename is called PlayerInventory.
@KetraGames2 жыл бұрын
Hi, yes, usually the name of the file is the same as the name of the class.
@CCLawhon Жыл бұрын
If you are looking to add sound to these collectibles where it plays once...I found a solution :) I made a tutorial here: kzbin.info/www/bejne/q5LdoYKElJV9mqM (Edited because the parent object sound didn't always work, and you couldn't keep it from playing anytime you entered the area even if collectable was gone). ...basically just add a sound object on top of the collectable... and give that its own collider, audio source, and the "Play Sound on Enter" script in the tutorial :) I got the sound script from @ChrisTutorialsYT kzbin.info/www/bejne/e2iQeXSAaamVbJY, then I added a bool for "if already played".
@sajjadkhan28582 жыл бұрын
I had requested you to make tutorial on how we can access our collected coins from other scenes...
@KetraGames2 жыл бұрын
Hi, we've added it to the list to cover in a future video 👍
@mamtapatil18922 жыл бұрын
How we can spawn diamonds randomly on terrain, please help 😊
@KetraGames2 жыл бұрын
Hi, you could generate a navmesh for the walkable area of your terrain. Then you could find random points on the navmesh to place diamonds. This link may help answers.unity.com/questions/475066/how-to-get-a-random-point-on-navmesh.html
@mamtapatil18922 жыл бұрын
@@KetraGames Thank you for replying so quickly. Actually you know what, i am a total beginner and i have to submit my project after 2 days. So can you please make a quick video on this topic i am sure many us want a video on topic. Please