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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by darkal · Sep 19, 2013 at 01:14 PM · inventorypickupitem

make inventory script get variables from item's script

my goal is to make it so when i click items gui button it put the items info into the inventory as it should

i perfer not to add the items info to the inventory script ill perfer if it got the info it needs threw the items script this is my inventory script it is working please do not CHANGE or recommend changing it unless the changes keep the inventory script still working

 var inventoryActive : boolean = false;
 var weaponlistActive : boolean = false;
 var armorlistActive : boolean = false;
 var clothinglistActive : boolean = false;
 var jewerlylistActive : boolean = false;
 
 var inbw = 0;
 var inbh = 75;
 
 var weaponhight = 100;
 var armorhight = 125;
 var clothinghight = 150;
 var jewerlyhight = 175;
 var bw = 0;
 var size = 100;
 var size1 = 25;
 
 var lwh = 125;
 var lch = 150;
 var ljh = 175;
 var lah = 100;
 var law1 = 100;
 var law2 = 175;
 var law3 = 250;
 var lasize = 75;
 var lasize1 = 25;
 
 var item = "";
 
 function OnGUI()
 {
     if (GUI.Button(Rect(inbw, inbh, size, size1), "Inventory"))
     {
     inventoryActive = !inventoryActive;
 }
 
 if(inventoryActive){
         
         if (GUI.Button(Rect(bw, weaponhight, size, size1), "Weapons"))
         {
         weaponlistActive = !weaponlistActive;
         }
         if(weaponlistActive)
         {
             GUI.Box (Rect (law1, lah, lasize, lasize1), item);
             GUI.Box (Rect (law2, lah, lasize, lasize1), item);
             GUI.Box (Rect (law3, lah, lasize, lasize1), item);
         }
         
         if (GUI.Button(Rect(bw, armorhight, size, size1), "Armor"))
         {
         armorlistActive = !armorlistActive;
         }
         if(armorlistActive)
         {    
             GUI.Box (Rect (law1, lwh, lasize, lasize1), item);
             GUI.Box (Rect (law2, lwh, lasize, lasize1), item);
             GUI.Box (Rect (law3, lwh, lasize, lasize1), item);
         }
         
         if (GUI.Button(Rect(bw, clothinghight, size, size1), "Clothing"))
         {
         clothinglistActive = !clothinglistActive;
         }
         if(clothinglistActive)
         {
             GUI.Box (Rect (law1, lch, lasize, lasize1), item);
             GUI.Box (Rect (law2, lch, lasize, lasize1), item);
             GUI.Box (Rect (law3, lch, lasize, lasize1), item);    
         }
         
         if (GUI.Button(Rect(bw, jewerlyhight, size, size1), "Jewerly"))
         {
         jewerlylistActive = !jewerlylistActive;
         }
         if(jewerlylistActive)
         {
             GUI.Box (Rect (law1, ljh, lasize, lasize1), item);
             GUI.Box (Rect (law2, ljh, lasize, lasize1), item);
             GUI.Box (Rect (law3, ljh, lasize, lasize1), item);    
         }
     
     }
 }


this is my items script please concentrate all changes here

     var details : boolean = false;
     var detaillistActive : boolean = false; 
     var tunnelwidth = 500; 
     var tunnelheight = 200; 
     var tunnel1 = 100; 
     var tunnel2 = 30;
     var law = 500;
     var lah = 230;
     var size = 100;
     var size1 = 25;
     var item = "Cube";
     var pickw = 500;
     var pickh = 255;
     var picksize = 100;
     var picksize1 = 25;
  
         function OnGUI ()
         {
             if (details)
             {
                 
                    if (GUI.Button(Rect(tunnelwidth, tunnelheight, tunnel1, tunnel2), "Cube"))
                    {
                    detaillistActive = !detaillistActive;
                    }
                    if(detaillistActive)
                    {
                    GUI.Box(Rect(law, lah, size, size1), item);
                    GUI.Button(Rect(pickw, pickh, picksize, picksize1), "Pick-up");
                    }
            }
         }
        function OnTriggerEnter(other : Collider)
        {
             if(other.tag == "Player")
             {
                 details = true;
             }
        }
  
        function OnTriggerExit(other: Collider)
        {
             if(other.tag == "Player")
             {
                 details = false;
             }
         }
Comment
Add comment · Show 2
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 getyour411 · Sep 20, 2013 at 03:01 AM 0
Share

I don't see a method or function like AddItemToInventory() - do you have one?

avatar image darkal · Sep 29, 2013 at 01:10 AM 0
Share

no i dont know how to go about that which is why im asking and there is a button on the item that when i click it it bring up the pick-up option/desiption

0 Replies

· Add your reply
  • Sort: 

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

15 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Unable to usem item from inventory 1 Answer

Making A Universal Pickup Script 1 Answer

Problem with picking up objects using a raycast and placing them in the inventory. 1 Answer

MissingReferenceException Help Please! 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