Closed gillen033 closed 1 year ago
Thanks for reporting this. I haven't worked with addressables, can you describe how to reproduce this error please?
Hi, I sure can.
1) Download the Addressables package, then try marking a prefab as addressable in the inspector (top of inspector window) (or a scene should work too).
2) Open the Addressable Groups window via Window -> Asset Management -> Addressables -> Groups.
3) Make sure the prefab or scene you marked as addressable is added to Default Local Group.
4) Choose Build -> New Build -> Default Build Script
5) The errors should appear.
To be honest I wouldn’t think this is just related to Addressables, but I could be wrong. When you build a normal project without Addressables you don’t see any errors? If that is the case, perhaps Attributes are automatically stripped from scripts on a normal build and that’s why there isn’t an issue. In which case this could be a Unity Addressables bug, as I would expect the behavior to be the same when building the Addressable Content as it is for a normal build.
In any case, the issue is very easily resolved by placing #if UNITY_EDITOR/#endif around the attributes and the using ExternalPropertyAttributes; statement.
From: Dustyroom @.*** Sent: Sunday, February 5, 2023 11:14 AM To: Dustyroom/flat-kit-doc Cc: gillen033; Author Subject: Re: [Dustyroom/flat-kit-doc] The type or namespace name 'X' could not be found (Issue #102)
Thanks for reporting this. I haven't worked with addressables, can you describe how to reproduce this error please?
— Reply to this email directly, view it on GitHub https://github.com/Dustyroom/flat-kit-doc/issues/102#issuecomment-1418100056 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRA62ZMNH4MF3FZ4UQJUEDWV7GUNANCNFSM6AAAAAAURRHOBM . You are receiving this because you authored the thread.Image removed by sender.Message ID: @.***>
Thanks for the instructions. This error does not appear in normal builds, the attributes are stripped there.
We can't reproduce this error so far. Moreover, there is no file Assets\FlatKit\Demos\Common\Scripts\Motion\NoiseMotion.cs
in Flat Kit 3.3.0. Can you please check what is referencing it and how?
Describe the bug There are several attributes that cannot be found when building Addressables using the Default Build Script. Most likely the issue occurs when building the Player too but I did not test that.
The reason seems very simple. You have placed the Attributes in the FlatKit.Utils.Editor namespace via an Assembly Definition Asset, which is configured only for the Editor. On a build unity strips this namespace and all references to the attributes cannot be resolved.
Attributes should be placed in a namespace that is valid for any Platform, as there is no reason they cannot be used on Any Platform. The drawers for the Attributes of course needs to be in the Editor namespace.
Sample of Errors: 1) Assets\FlatKit\Demos\Common\Scripts\Motion\NoiseMotion.cs(1,7): error CS0246: The type or namespace name 'ExternalPropertyAttributes' could not be found (are you missing a using directive or an assembly reference?)
2) Assets\FlatKit\Demos\Common\Scripts\Motion\NoiseMotion.cs(6,6): error CS0246: The type or namespace name 'BoxGroupAttribute' could not be found (are you missing a using directive or an assembly reference?)
Unity details:
Build platform:
Additional context Add any other context about the problem here.