Is it possible to make an assetbundle from commandline?
So far I have only managed to find information about it being possible as editor scripts on selected models.
Is it possible to make an assetbundle from commandline?
So far I have only managed to find information about it being possible as editor scripts on selected models.
You can execute the Unity executable and instruct it to run an editor script function:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -projectPath /PathToMyProject -executeMethod MyEditorScript.MyStatic Function -quit
Thanks but I don’t seem to get the functionality I am aiming for.
All documentation and examples are referring to Selection:
var selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
… while I am after a solution where the commandline tells the script in Unity what file to “select” and use to build the assetBundle from.
Is there any way of getting a scripted selection happening, or does it always have to be performed by a human operating a mouse? Basically I’d like to replace myself with a shell script. ![]()
After some help from NCarter on IRC I found a solution by doing this:
var arr : GameObject[] = new GameObject[1];
arr[0] = EditorUtility.FindAsset("Artwork/Lerpz.fbx",GameObject);
Selection.objects = arr;
Is it possible to pass arguments from the commandline to the Unity script? I.e. a string to tell what file to build?
I’m interested also to know if I can read a string in Unity passed from command line (like any other console program).
Maybe using Pro version?
you can’t read from the command line
but nothing prevents you from having a config file that you read in that contains one or more command line arguments
That’s a good idea!
Thank you!