LoginSignup
1
0

More than 3 years have passed since last update.

[Unity Addressable Asset System] AssetReferenceLabelRestriction が無い問題と AssetReferenceUILabelRestriction のビルドに失敗する問題

Last updated at Posted at 2019-08-10

問題

https://www.youtube.com/watch?v=Rls8e7tZUNE&t=33s
というありがたい動画にある AssetReferenceLabelRestriction を使ったが、そんなものはないと怒られた。

調査

https://docs.unity3d.com/Packages/com.unity.addressables@0.6/changelog/CHANGELOG.html
にある、

Attribute AssetReferenceLabelRestriction is renamed to AssetReferenceUILabelRestriction and must be surrounded by #if UNITY_EDITOR in your game code, to enforce it's editor-only capability

が見つかった。

Google 翻訳にかけると、

属性AssetReferenceLabelRestrictionはAssetReferenceUILabelRestrictionに名前が変更され、ゲームコードで#if UNITY_EDITORで囲む必要があります。これは、エディターのみの機能を強制するためです。

解決法

つまりはこう使えということ。

#if UNITY_EDITOR
using UnityEditor.AddressableAssets.GUI;
#endif
#if UNITY_EDITOR
    [AssetReferenceUILabelRestriction("Map")]
#endif
    public AssetReference reference = null;

なんか……スマートじゃない。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0