How do I use “-executeMethod ClassName.StaticMethodName” when using assembly definitions? Unity is unable to find the class when I use an .asmdef file.
Example path “Assets/Plugins/Build/BuildTool.cs” and “Assets/Plugins/Build/Build.asmdef” with a “public class BuildTool” without a specific namespace and a method “public static void DoStuff(){}”;
Like here is nothing to place in repo. Or you need a reported bug in system?
Unity.exe -quit -batchmode -executeMethod MyEditorScript.PerformBuild only works for class MyEditorScript in Editor default assembly. It can’t be used with custom .asmdef file.
Yes, please report a bug so we can track and get all the details right. There could be multiple bugs in this area and we want to make sure we fix the one you are encountering
The method I am trying to call with -executeMethod is a public static method inside a class which is in an assembly definition with only “Editor” ticked as a platform.
I get:
Aborting batchmode due to failure:
executeMethod method ‘METHODNAME’ in class ‘NAMESPACE.CLASS’ could not be found.
This appears to still be an issue unless I am doing something wrong @lukaszunity was this ever reported as a bug and fixed?
EDIT: This was fixed. I was just running into a different issue where Unity continues the import on failing the script compile and then complains that it can’t find the script
I never had the problem in the first place. My problem was of a different nature. The problem statement here was that you cannot call classes from asmdef files. Which is possible now. You can still run into the error: “Class not found” if your scripts fail to compile in the first place.
It doesn’t seem like they added a note to the release notes. I checked my release notes database and the only one found where “executeMethod” was mentioned was in the 2020.1.0 notes. Though on a different topic. Maybe the issue (with asmdef files) wasn’t actually related to the “executeMethod” command line argument but may had its roots deeper in the system. So it’s difficult to search for it in the release notes.
(ps: I have a mysql table with all release notes, manually copied ^^. So I can actually do more sophisticated searches on them. Google and other search engines are not reliable enough. They tend to forget things if they age).