cemuka / basic-merge-system

a little demo to demonstrate merge mechanics in unity
8 stars 0 forks source link

Basic Merge System compatibility issue with other assets #2

Open jmeyer1980 opened 2 hours ago

jmeyer1980 commented 2 hours ago

Firstly, thank you for your work. I have mentioned this situation in the Pinus Craft Discord as well.

Because the scripts are not isolated within your namespace, the package is incompatible with other developers assets even if they isolate their code within their own namespace. Things like Item and Params are used by a few developers with inventory systems.

If you enclose your scripts within a namespace, this will resolve the issue.

jmeyer1980 commented 2 hours ago
using UnityEngine;

namespace PinusCraft.BasicMergeSystem
{
    public static class Utils
    {
        public static GameResources gameResources;

        public static GameResources InitResources()
        {
            Debug.Log("Resources initialized.");
            return gameResources = Resources.Load<GameResources>("GameResources");
        }

        public static Sprite GetItemVisualById(int itemId)
        {
            return gameResources.items[itemId];
        }
    }
}