question

contact-3 avatar image
contact-3 asked

SDK for Unity 2017.4 LTS (probably 2018 too) has no Editor asmdef. Fails to build standalone.

Hi,

In Unity 2017+ using asmdef files counters Unity figuring out "Editor" folders to be excluded on builds. Causing build failures with for instance playfab unity SDK.

We have to manually exclude them with an editor only asmdef.

Below our current workaround moving all editor folders in one place and adding an asmdef,

Best

unity3dsdks
capture.jpg (70.0 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

We will look into this issue. I'll file a ticket for investigation.

As far as I know Editor Extensions and any Editor files in the PlayFab SDKs do not cause compile or build errors in any Unity Versions (tested on all versions post Unity 5.6).

So I'm confused as to what the repro steps are to make that happen. Can you provide steps to reproduce this issue?

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jay Zuo avatar image Jay Zuo ♦ commented ·

I'd believe @contact-3 used assembly definition files which is newly added in Unity 2017.3. To reproduce this issue, we can add a .asmdef file under "PlayFabSdk" folder. Then when we try to build the project we will get some build error. This is because Unity gives priority to the assembly definition files over the Predefined Compilation System. And this will cause "Editor" folders in PlayFabSdk have wrong references. There are some discussions about this issue like https://forum.unity.com/threads/example-project-assembly-definition-files.482313/page-4#post-3296568. As PlayFabSdk does not use assembly definition files, I don't think this is a SDK issue. But if all editor related files in PlayFabSdk can be put in one folder might be helpful for @contact-3's issue.

0 Likes 0 ·
contact-3 avatar image contact-3 Jay Zuo ♦ commented ·

Yes it will concern unity 2017.2+ builds when you need to have a reference to playfabSDK while you're using your own asmdef for your code. In order for it to work with current version of the SDK you must 1. Put an asmdef file ie"playfab-sdk" in the root folder of playfab. 2. Put together all editor only files with their own asmdef "playfab-sdk-editor" (with editor only setting as stated in my OP) 3. Reference "playfab-sdk" in "playfab-sdk-editor" asmdef. Then you can reference playfab sdk in your own assemblies if needed.

0 Likes 0 ·
Jay Zuo avatar image
Jay Zuo answered

PlayFab Unity SDK does not use assembly definition files. And for the "Editor" folders issue, this is because

Unity gives priority to the assembly definition files over the Predefined Compilation System. This means that having any of the special folder names from the predefined compilation inside a assembly definition file folder does not have any effect on the compilation. Unity treats these as regular folders without any special meaning.

For more information, see https://forum.unity.com/threads/example-project-assembly-definition-files.482313/page-4#post-3296568

Moving all editor folders into a separate assembly is a workaround, also you can try with "#if UNITY_EDITOR #endif" block like in this answer.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.