Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Loading .blend files at runtime

Discussion in 'Scripting' started by purhur, Jun 19, 2016.

  1. purhur

    purhur

    Joined:
    May 16, 2016
    Posts:
    4
    Hello there,

    does anybody have some tips for me for the topic "Loading .blend files at runtime". I found something for loading .obj files but that unfortunately doesnt work for .blend files. Are there any public unity classes that does exactly the same, as when i load a .blend file in the asset folder?

    Best Wishes
     
  2. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    First of I would convert them into .obj in blender, then load it up that way. If you can load it into the game before hand turn all the .blend files into prefabs then make a list of public game objects in a class on an empty game object with a unique name, get the script from the game object by doing something like:
    Code (CSharp):
    1. ListOfGameObjects logo = GameObject.Find("Unique GameObject Name Here").GetComponent<ListOfGameObjects>();
    Then instantiate the game object by doing something like:
    Code (CSharp):
    1. GameObject blend = GameObject blend = Instantiate(logo.blendGameObject);
    Then I assume you can edit the position and stuff yourself afterwards :)
     
  3. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    .....what?

    Short answer - no. You'd have to write a parser yourself.

    Alternatively, you can look into using AssetBundles or Streaming Assets. Depends on what you're trying to do ultimately.
     
  4. purhur

    purhur

    Joined:
    May 16, 2016
    Posts:
    4
    For the people who are interested in this. I will export it in runtime to obj and then go from this startingpoint. Thanks for your help.