Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Mike McFarland · Dec 10, 2012 at 07:05 PM · blenderimportingcontinuous-integration

Importing assets that need pre-processing (like .blend) from the Unity commadline for a CI Server

I am setting up a CI server for our unity project and I am running into a problem with assets that must be imported and pre processed by unity. Specifically .blend files. What I've made so far produces a web build of the project at the location I expect, however it appears the .blend files we have within the project aren't getting imported into Unity before it builds. Any assets that already are .fbx files are working fine. I'm aware that Unity actually ends up using blender to import these files (or other programs based on the other types you put into the project directories) and I'm wondering if there is a way I can make sure it does its import step involving other programs, like blender. The machine working from the command line has blender installed, and can import and build the project properly, if done so manually from the unity editor.

If there isn't an easy way to do this, I am wondering if there is a way to call the same functionality that Unity uses to prepare the assets myself. I recognize that python files are used in importing the assets using blender, for example : `Unity/Editor/Data/Tools/Unity-BlenderToFBX.py` However I don't really know python, and I'm unsure where to begin trying to determine how I would do this step outside of Unity, while making sure I use the same process unity does (The whole point is the test that these files will import and build properly through a fresh check out and with the unity editor) Any information or suggestions to help me achieve my goal would be much appreciated.

Here's more specifics about the automated build process

  1. Checking out the files for the project from svn

  2. Creating a new Unity Project from the command line

  3. Adding the files checked out into the project

  4. Running Unity from the command line with these arguments: `-batchMode -quit -nographics -executeMethod AutoBuilder.PerformWebBuild`

AutoBuilder looks like this:

 public class AutoBuilder
 {
     private const string NAME = "name";
     private const string TARGET_DIR = "target";
 
     [MenuItem ("Custom/CI/Web Build")]
     public static void PerformWebBuild()
     {
         //AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
         string locationPathName = TARGET_DIR + "/" + NAME;
         string[] scenes = FindEnabledEditorScenes(); 
 
         string res = BuildPipeline.BuildPlayer(scenes, locationPathName, BuildTarget.WebPlayer, BuildOptions.None);
         if (res.Length > 0)
         {
             throw new Exception("BuildPlayer failure: " + res);
         }
         
     }
 
     private static string[] FindEnabledEditorScenes()
     {
         List<string> EditorScenes = new List<string>();
         foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
         {
             if (!scene.enabled) continue;
             EditorScenes.Add(scene.path);
         }
         return EditorScenes.ToArray();
     }
 
 }
 

I have tried running `AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);` before beginning a build in hopes it would import blend files , but it does not. Also, there is absolutely no mention of working with any of the .blend files in the unity log, that also includes errors importing them.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sed · Nov 17, 2015 at 10:46 AM

I know it's "a bit" too late for the answer to be helpful to you. So just for the record:

You could use additional step between 3 and 4 to convert all .blend files to .fbx for that you could use a blender installation and run it in the command line / bash / terminal mode.

You can find the python code here: https://github.com/iamsed/blendToFbxExporterForUnity

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

importing my blender works to unity 2 Answers

Importing complex objects from Blender with colors 1 Answer

Blender importing materials & textures incorrect with new, default embedded method. 0 Answers

Importing Blender Models 5 Answers

Blender to Unity, import object with 2 materials. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges