Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 salamander555 · Jan 16, 2017 at 04:30 PM · listscrafting

Crafting items. Best way to do it?

Hey,

so I am working on a 2D survival game and i am struggling a bit with finding the right way to make crafting work. so what I currently have (that work) is that i check a list with all my inventroy item. and if the right amount of items(crafting recipe is also a list) that you need to craft an item are in there the item that you can craft will add to another list. now what is the best way the check if you can craft an item. i'm currently thinking about 2 option - option 1: I put all the crafting recipes in 1 script and run them trought the inventory list. - option 2: I make a 'fake' copy of all craftable item in the world scene with only the crafting recipe variable on them.

Option 1 think will take a much bigger script but with option 2 you"ll have a shorter script but you have all those item copy's in the world. and i cannot put the crafting recipe in prefab (right?). because the game won't load them.

how option 1 would look in my game:

 Public List<string> item1
 public List <int> item1amount
 public List <string> item2
 public List<int> item2amount
 public List<string> item3
 public List <int>item 3 amount;
 
 public List<string> inventory items
 
 
 void {
 if (inventory.contains(item1))
 {
 *my system to check amount of items about 3 (this isn't important now*
 {
 add item 1 to craftable items list
 }
 }
 
 if (inventory.contains(item2))
 {
 *my system to check amount of items about 3 (this isn't important now*
 {
 add item 2 to craftable items list
 }
 }
 
 if (inventory.contains(item3))
 {
 *my system to check amount of items about 3 (this isn't important now*
 {
 add item 3 to craftable items list
 }
 }

ass you see this would be a very large script(or is there maybe a way to run multiple list throught another list) but otherwise you just have the lines for item1 in 1 script attached to every item then i put in the needed in for each.

i don't know if everything is clear if not just ask adn thank you for trying to help.

Comment
Add comment
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

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

60 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 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 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

Lists, and Crafting? 1 Answer

Lists within lists to make a crafting system 1 Answer

I'm trying to make a button that instantiates an item when you craft it 1 Answer

[Answered](C#)Comparing two Lists for a Crafting System 2 Answers

Undo/back system using a List/Array 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