Unity executeMethod class could not be found

Hello,

I am having a problem with building unity from the command line.
I followed this tutorial here. Unity - Manual: Command-line arguments

Here is the command that I am running

/Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath $PROJECT_DIR -batchmode -logFile $PROJECT_DIR/androidUnityBuild.log -executeMethod AutoBuild.PerformBuild -quit

My AutoBuild.cs that sits in the same directory looks like this

using UnityEditor;
public class AutoBuild {
static void PerformBuild() {
string[ ] scenes = {“Assets/Scenes/Scene1.unity”, “Assets/Scenes/Scene2.unity”};

// Later on use this to switch between building for different targets
// EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android);
BuildPipeline.BuildPlayer(scenes, “Builds/Android”, BuildTarget.Android, BuildOptions.None);
}
}

My error is
executeMethod class ‘AutoBuild’ could not be found.
Argument was -executeMethod AutoBuild.PerformBuild

(Filename: /Applications/buildAgent/work/d3d49558e4d408f4/Runtime/Utilities/Argv.cpp Line: 117)

Aborting batchmode due to failure:
executeMethod class ‘AutoBuild’ could not be found.
Argument was -executeMethod AutoBuild.PerformBuild

I played around setting/unsetting the -project path, and that didn’t seem to do anything. If anyone has any insights in to this, that would be amazing.

Thank you!

Did you ever resolve the issue?

If someone encounters the same problem here is my suggestion. I’ve managed to solve this error by adding full namespace to the class name. I.e. UnityTools.Awesome.AutoBuild.PerformBuild