- Home /
Automating playmode from batch and C#; executemethod could not be found
I am trying to automate the process of opening up a specified Unity file and entering playmode via a batch command that accesses a C# method.
My batch:
START "" /D "C:\Program Files\Unity\Editor" "Unity.exe" -projectPath "C:...\MyProject" -executeMethod MyEditorScript.Start
My C#:
using UnityEditor;
class MyEditorScript { static void Start() { UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Play"); }
}
I read something on the forums about placing the class accessed by the batch file inside an Editor folder inside Assets which I have done; however, upon execution of the batch file, Unity still throws the error "executeMethod class 'MyEditorScript' could not be found"
Ideas??
Answered my own question. I ended up just reimporting all assets and the error went away. I'm assu$$anonymous$$g that since I created the file externally, forcing Unity to update the Assets internally upon my change, rather than importing my new file into the Assets of the project myself, Unity somehow screwed up the location or contents of my file?? Not sure... When in doubt, reimport all assets
Answer by cory_k · Jun 09, 2016 at 12:02 PM
@justinsegler I had the same problem. For me, I found the .meta file for the script was missing, therefore Unity couldn't find it to build. I built the project from the editor, and this created the .meta file. Which also updates the assets database (I think is how it works).
Your answer
Follow this Question
Related Questions
Webplayer exception when using BufferedStream 0 Answers
Method not found: 'UnityEngine.AudioSource.PlayOneShoot'. 1 Answer
Mutator method to change multiple bool variables? 2 Answers
How to execute a function which is implemented in .NET when I have its name as a string? 1 Answer
Can't assign SetActive because it's a "method group". 0 Answers