Help us understand the problem. What is going on with this article?

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

問題

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;

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした