IntoTheDev / MultiTag-System-for-Unity

This package allows you to Tag Game Objects with ScriptableObjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work in IOS

whynames opened this issue · comments

Hey, HasTag check doesn't work in IOS Iphone,but works in editor. It doesn't work only when gameobjects are instantiated via addressables. Maybe Taggable component acts differently when loaded with addressables? What might be the reason

Hello! Does the tag checking throw an exception, or does it just return a false result? Could you please build a PC or Android version and check if the results are different? Also, try debugging what gameObject.GetHashCode() returns.

I don't know if I'll get this fixed soon, because I've got a busy schedule with my current project, and I'm also considering rewriting whole thing to use an enum flag instead of SOs.

It doesn't give error, only returns false. Also I confirm issue is related to the link you gave. When addressables changed to build version, it doesn't work like in build. At least I can test without making builds now :) One idea might be making a static container to have reference for all scriptable objects and get reference from that, but for you performance is an issue I guess

Hey! I managed to "fix" that issue in my empty project.

  1. Make your tags and gameplay scenes an addressables.
    image

  2. Make an empty loader scene that will load your gameplay scene.
    image

  3. Now you're using correct instance of tags, and everything should work fine.

I'll attach the code from this project, just in case.

using UnityEngine;
using UnityEngine.AddressableAssets;

public sealed class Loader : MonoBehaviour
{
    [SerializeField] private AssetReference _sceneReference;

    private void Awake()
    {
        Addressables.LoadSceneAsync(_sceneReference);
    }
}
using ToolBox.Tags;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

public sealed class Tester : MonoBehaviour
{
    [SerializeField] private AssetReferenceGameObject _prefab;
    [SerializeField] private Tag _tag;

    private void Awake()
    {
        _prefab.InstantiateAsync().Completed += OnCompleted;
    }

    private void OnCompleted(AsyncOperationHandle<GameObject> obj)
    {
        Debug.LogError(obj.Result.HasTag(_tag).ToString());   
    }
}

Hey again, thanks, I learnt if you use addressables you need to load your scenes by addressables too. It works now. There was no mistake originating from this repo so I close the issue. Also thanks for making this repo available.