問題
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;
なんか……スマートじゃない。