Adding an asset to a scene in unity batch mode

Hi,

I have fbx files representing assets for unity. I want, for each fbx file, automatically import the asset in unity, then add it to the scene, build it and close unity. For the moment, I am at the first step… How do I import an asset and add the object to the scene using unity batch mode?

Thanks in advance for any help.
Best regards.
K.
PS: I am a newbie in this so do not hesitate to point me in the right direction if I am wrong.

If you have the assets in a package, you can add them from the command line using the -importPackage switch (see the manual page for details).

Hi,

thanks for your answer. No, my assets are not in a package. They are generated “from outside” unity as a bunch of fbx files only…

Best regards.
K.

Then you don’t need to import them but have them in the corresponding assets subfolder of the project and process them.
But generating whole worlds basing on this will become a pretty extensive task if you want to write loaders that especially load and assign correct materials and shaders etc. You will spend a fair amount of time writing all the required code to get automatisms done.

Do you mind if I ask what you attempt to do thats that far outside of Unity’s regular way of working?
The Batch Mode is commonly used to do overnight builds of large projects or builds for different targets. Since 2.1 especially the building of asset bundles got in which is a pure editor script thing anyway.

Personally: I think you are the second user in my 2 years here that seems to want to avoid the unity editor by any means, investing a lot of time in recreating stuff that unity would offer if it were used how it was designed to be used.
The only reason for that I came up with so far why anyone would want to avoid the significant production time savings from unity is using an external editor to generate data and use the batchprocessing etc to generate the client, with the basic meaning that 1 Unity Pro license is sufficient for X people not using unity but generating batch processable content though I’m pretty sure that this kind of usage actually would be illegal

Hi,

great! I did not even believe it would be so simple…;-).

Thanks a lot.
K.