Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by shadows_s · Dec 19, 2013 at 06:40 PM · prefabassetinventoryitem pickup

Simple inventory

I try to implement simple inventory system. And stuck on pickup functionality. Example of taking the Potion:

  1. Collide with Potion object.

  2. Add it to the Inventory

  3. List item Remove it from the scene

How to implement this? At the step 2, i must take reference to asset or prefab? Inventory must store a GameObject's ?

Any idea, resource or tutorial will be helpfull. *I need to implement exactly this algorithm. Thanks.

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JSierraAKAMC · Dec 19, 2013 at 06:43 PM 0
Share

Are your items or inventory created with a class? You need to give us a little more information about the content of your potion and inventory scripts.

avatar image highpockets JSierraAKAMC · Dec 19, 2013 at 06:51 PM 0
Share

You should not have posted this comment as an answer. You just asked him a question about his question. Now the question has been taken off of the unanswered question's list, which will lower his/her chances of having someone answer it.

avatar image highpockets JSierraAKAMC · Dec 19, 2013 at 06:55 PM 0
Share

Please click the more button under your answer and choose convert to comment. $$anonymous$$aybe that makes it an unanswered again.

avatar image JSierraAKAMC · Dec 19, 2013 at 07:10 PM 0
Share

It is a comment. Notice that it is directly under the original post and there are 0 answers.

avatar image JSierraAKAMC · Dec 19, 2013 at 07:11 PM 0
Share

Also, notice it is still under the unanswered list.

avatar image fafase · Dec 19, 2013 at 07:13 PM 0
Share

Notice that I just moved it as a comment since it was posted as an answer

avatar image highpockets · Dec 19, 2013 at 07:18 PM 0
Share

Thanks fafase. I don't have the authority to do so yet. haha

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Pemu · Dec 19, 2013 at 07:39 PM

So...

  1. You must create a Potion.

  2. Create for example 3 slots Inventory.

  3. When you collide with Potion, his script must SendMessage to 3 slots. When 1 is free, potion comes to 1, when 2 is free, potion comes to 2, etc...

  4. Script Potion must have information:

     var ob : GameObject;
         var ob2 : GameObject;
         var ob3 : GameObject;
          function OnTriggerEnter(other : Collider){
         
         if(other.tag=="Player"){
         
         ob.SendMessage("Slot");
         
         ob2.SendMessage("Slot"); //Call function "Slot" (he place your potion to inventory)
         
         ob3.SendMessage("Slot");
         
         Destroy(gameObject);  //Destroy Potion
         }
         }
    
    

So - you already know how to do it?

Sorry for my English ;d

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Prefabs not visible in webplayer? (read from .txt file) 1 Answer

Any way to fix texture stretching on imprted objects? 2 Answers

Inventory Item preview 1 Answer

assets hidden children of an fbx. 2 Answers

Trouble working with a Custom class, JavaScript. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges