How to Collect Items (Unity Tutorial)

How to Collect Items (Unity Tutorial)

Ketra Games

2 года назад

57,746 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Alex Muscat
Alex Muscat - 16.09.2023 23:17

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

Ответить
Sami Rehman
Sami Rehman - 21.08.2023 18:53

finally someone who didn't use destroy function on collectable.

Ответить
Sherlock Holmes
Sherlock Holmes - 03.08.2023 00:37

Hi there! What if I want the diamonds to spawn randomly during the day?

Ответить
Sidhartha Mandal
Sidhartha Mandal - 30.07.2023 21:45

Ответить
Jejo Games
Jejo Games - 09.07.2023 20:22

a me non va

Ответить
JPM_ art_
JPM_ art_ - 07.07.2023 15:18

Amazing video!

Ответить
Nega-Guy
Nega-Guy - 03.07.2023 10:44

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.

Ответить
Young gun lover
Young gun lover - 15.06.2023 12:49

great tutorial!

Ответить
Damonte Booze
Damonte Booze - 12.04.2023 04:00

bruh I got an error something about it not containing a defintion

Ответить
DannyG
DannyG - 06.04.2023 22:57

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?

Ответить
Aryan Patankar
Aryan Patankar - 21.03.2023 15:42

Thanks!
it worked for my mobile game!

Ответить
Luisa
Luisa - 12.03.2023 14:34

Super helpful 🤩

Ответить
Tigran Avagyan
Tigran Avagyan - 10.03.2023 21:25

Thank you VERY MUCH for this video👍

Ответить
Tangarorang Uzzi Keir B.
Tangarorang Uzzi Keir B. - 12.02.2023 16:58

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.

Ответить
Izzu
Izzu - 11.02.2023 19:26

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?

Ответить
Qistina Alia
Qistina Alia - 21.01.2023 09:12

Hi I cant seem to find the update diamond text method, can you help me?

Ответить
MxBshr
MxBshr - 17.01.2023 19:46

my fpc character just runs straight through the gems, i followed your code exactly and i cannot get it to work

Ответить
Wraith
Wraith - 01.01.2023 19:59

TYSM IT HELPED MY GAME SOO MUCH

Ответить
Muhammad Habibulloh
Muhammad Habibulloh - 17.12.2022 21:36

please help me, I have followed the script but the diamonds don't disappear when they are taken 🙏🏻

Ответить
SIR_9
SIR_9 - 15.12.2022 18:09

Perfect! "thx you";

Ответить
Hans Christian
Hans Christian - 28.11.2022 23:58

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.

Ответить
Corrohsive Gaming
Corrohsive Gaming - 27.11.2022 23:49

Lovely video! The only part I am wondering is how would I add a sound to when I collect a diamond?

Ответить
Jk Air
Jk Air - 20.11.2022 14:30

does anyone know how to get a "you win" page when the player have collected 10 items?

Ответить
Глеб Козлов
Глеб Козлов - 17.11.2022 20:39

Man that was delightful. After all those rushy tutorials this series is a breath of fresh air. Thank you!

Ответить
Javiera Paz Díaz Castro
Javiera Paz Díaz Castro - 22.10.2022 09:23

Your voice is so calming <3

Ответить
Redna
Redna - 20.10.2022 04:12

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?

Ответить
Redwes702
Redwes702 - 18.10.2022 04:48

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?

Ответить
Darkwar9099 Borderlands 3
Darkwar9099 Borderlands 3 - 16.10.2022 02:53

Nice vid it works great on my own game

Ответить
mamta patil
mamta patil - 29.09.2022 19:31

How we can spawn diamonds randomly on terrain, please help 😊

Ответить
Testikills
Testikills - 24.09.2022 12:39

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?

Ответить
Aleksandra Aleksandra
Aleksandra Aleksandra - 22.09.2022 21:56

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?🙄

Ответить
James Z Chan
James Z Chan - 18.09.2022 12:06

How can I make the item only be pickd up whn a player is holding a certain key?

Ответить
KB 4 JC
KB 4 JC - 09.09.2022 10:02

How can I make an item spawn after collecting all objects (diamonds)

Ответить
gabryel huneault
gabryel huneault - 05.09.2022 03:37

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!

Ответить
gabryel huneault
gabryel huneault - 05.09.2022 03:12

I can't use TMPro in my unity project because I'm using unity 5.6.7f1 and textmeshpro isn't available. Please help

Ответить
DARKprinc3
DARKprinc3 - 29.08.2022 16:04

life savior

Ответить
David Kunle
David Kunle - 28.08.2022 22:46

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.

Ответить
Raluca Teslovan
Raluca Teslovan - 21.08.2022 12:12

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!

Ответить
TJ Orloski
TJ Orloski - 18.08.2022 19:23

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

Ответить
Man of the bean
Man of the bean - 27.07.2022 14:34

thank you this was a big help in my game!!

Ответить
Vimal V
Vimal V - 10.07.2022 18:27

Where to add this scripts in first person play ?!

Ответить
WornTraveler
WornTraveler - 09.07.2022 12:30

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 😂

Ответить
BONSE 2000
BONSE 2000 - 12.06.2022 12:02

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

Ответить
NimoMania
NimoMania - 10.06.2022 01:22

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.

Ответить
NimoMania
NimoMania - 10.06.2022 01:05

this was so clear and its recent. im subbing

Ответить
Shang_Psycho
Shang_Psycho - 29.05.2022 07:58

This helped, thanks!

Ответить
Dimas Suhada
Dimas Suhada - 07.05.2022 10:20

Thank uu <3

Ответить
Sami Lehtinen
Sami Lehtinen - 04.05.2022 22:24

Great video...what if i want diamonds to be collected for example 20 and then congratulations on passing a level?

Ответить