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 Zastrow89 · Jun 27, 2012 at 06:24 PM · uiguiinventoryitems

inventory system some help and guides please :)

i have bene suing unity alittle bit now, for 6 months time, and i have made a few little dodads and other fun little things :) so i have decided to try and make a little for fun RPG nothing bug or huge just to get the hang of the coding of such things what i want is: and inventory like you see in world of warcraft, lord of the rings online etc. what it should do is:

  • you pick up an item from a mob / chest / anything. by clicking it.

  • it transfers the item to your inventory if you have the space.

  • if not you cannot pick it up and gets an error message.

  • you rightclick the item in your inventory to equip it in your character page.

  • your uneuqip same process just vice versa

i have an okay understanding of how to code alittle bit im no expert!! far far from it! what i made this far is an inventory script, added it to the player.()this script does nothing yet. and i made an item script that is as follows: `public class item : MonoBehaviour {

 public bool isEquipped = false;
     public int itemId;
     public int buyPrice;
     public int sellPrice;
     public GameObject itemVisual;
     public Texture2D icon;
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         
         //shows and hides item when equipped and unequipped
         if (isEquipped == true){
             itemVisual.renderer.enabled = true;
         }
         else itemVisual.renderer.enabled = false;
         ///////////////////////////////////////////////////
     
     }
 }

is this first of all a viable approach? and secondly how do i make the inventory? i know i can use gui etc but the drawcalls are just horrible!! how do you go about making such a thing? any help is much apreaciated! best regards -Martin

Comment
Add comment · Show 3
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 Eric5h5 · Jun 27, 2012 at 07:38 PM 0
Share

This is more of a discussion question that should be posted on the forums. Using OnGUI won't give you any more draw calls than this approach, and would be easier. Constantly checking isEquipped in Update is inefficient; it should just be done once when needed.

avatar image Zastrow89 · Jun 27, 2012 at 08:09 PM 0
Share

and how would i do that? how do i make a "function" like that? that i can call?

avatar image CrossTyreck · Jun 27, 2012 at 08:28 PM 0
Share

OnGUI is the function

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by CrossTyreck · Jun 27, 2012 at 08:40 PM

Your starting nice. One thing I did was created another camera to handle your GUI texture (Inventory) and have those textures render when an item is in the inventory or not. When the item is in your inventory its the corresponding 3D objects renderer is off. When the item is equipped, its no longer in your inventory so the image is off but the renderer is turned on. Hope that helps a little.

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

6 People are following this question.

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

Related Questions

How To Make A Numeric Inventory System? 0 Answers

Unity C# - Foreach loop - Inventory slot only changes quantity for the last child of an object 1 Answer

Is there a way to use the prefab image unity shows? 0 Answers

Help with GUILayout and tooltip(C#) 1 Answer

scroll bar inventory with slot count for equip items 0 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