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 /
  • Help Room /
avatar image
0
Question by TheGhost0 · Jul 25, 2020 at 07:48 AM · controllerinventory

Inventory for Ultimate Character Controller can be better then this ??

guys if you can help me to make my game better and faster with out any error this code are fixed but i want to change it to better and teach me the new code please .

 namespace Opsive.UltimateCharacterController.Inventory
 {
     using Opsive.Shared.Inventory;
     using UnityEngine;
     using System.Collections.Generic;
 
     /// <summary>
     /// The ItemSetManager manages the ItemSets belonging to the character.
     /// </summary>
     public class ItemSetManager : ItemSetManagerBase
     {
         [Tooltip("A reference to the ItemCollection that the inventory is using.")]
         [SerializeField] protected ItemCollection m_ItemCollection;
 
         public ItemCollection ItemCollection { get { return m_ItemCollection; } set { var prevItemCollection = m_ItemCollection; 
                                                                                         m_ItemCollection = value; 
                                                                                         Initialize(prevItemCollection != m_ItemCollection); } }
 
         /// <summary>
         /// Initializes the ItemSetManager.
         /// </summary>
         /// <param name="force">Should the ItemSet be force initialized?</param>
         public override void Initialize(bool force)
         {
             if (m_Initialized && !force) {
                 return;
             }
             m_Initialized = true;
 
             if (m_ItemCollection == null) {
                 m_CategoryItemSets = null;
                 return;
             }
 
             // The ItemTypes get their categories from the ItemCollection.
             for (int i = 0; i < m_ItemCollection.ItemTypes.Length; ++i) {
                 m_ItemCollection.ItemTypes[i].Initialize(m_ItemCollection);
             }
 
             // Initialize the categories.
             if ((m_CategoryItemSets == null || m_CategoryItemSets.Length == 0)) {
                 if (m_ItemCollection.Categories.Length > 0) {
                     m_CategoryItemSets = new CategoryItemSet[m_ItemCollection.Categories.Length];
                 }
             } else if (m_CategoryItemSets.Length != m_ItemCollection.Categories.Length) {
                 System.Array.Resize(ref m_CategoryItemSets, m_ItemCollection.Categories.Length);
             }
             if (m_CategoryIndexMap == null) {
                 m_CategoryIndexMap = new Dictionary<IItemCategoryIdentifier, int>();
             } else {
                 m_CategoryIndexMap.Clear();
             }
             m_ActiveItemSetIndex = new int[m_CategoryItemSets.Length];
             m_NextItemSetIndex = new int[m_ActiveItemSetIndex.Length];
             for (int i = 0; i < m_CategoryItemSets.Length; ++i) {
                 m_ActiveItemSetIndex[i] = -1;
                 m_NextItemSetIndex[i] = -1;
                 if (m_CategoryItemSets[i] == null) {
                     m_CategoryItemSets[i] = new CategoryItemSet(m_ItemCollection.Categories[i].ID, m_ItemCollection.Categories[i].name, m_ItemCollection.Categories[i]);
                 } else {
                     m_CategoryItemSets[i].CategoryID = m_ItemCollection.Categories[i].ID;
                     m_CategoryItemSets[i].CategoryName = m_ItemCollection.Categories[i].name;
                     m_CategoryItemSets[i].ItemCategory = m_ItemCollection.Categories[i];
                 }
 
                 // Create a mapping between the category and index.
                 var category = m_ItemCollection.GetCategory(m_CategoryItemSets[i].CategoryID);
                 m_CategoryIndexMap.Add(category, i);
 
                 // The ItemSet must be initialized.
                 for (int j = 0; j < m_CategoryItemSets[i].ItemSetList.Count; ++j) {
                     m_CategoryItemSets[i].ItemSetList[j].Initialize(gameObject, this, m_CategoryItemSets[i].CategoryID, i, j);
                 }
             }
         }
     }
 }

your friend yusuf

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

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

Trying to "condense" a lot of verbose code, for an inventory system. Don't know where to start. 0 Answers

FPS Walker bunny hops if stop walking while on slopes 2 Answers

Spaceship Script not working? 0 Answers

Animation doesn't seem to be saving> 1 Answer

Parented Game object with collider not colliding 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