c# - How to place Blender model in Unity using script? -


i made blender model , dragged in assets folder(.blend, not fbx). like

var robot = gameobject.instantiate (resources.load("robot")) gameobject; robot.transform.position = new vector3 (description.x, description.isround ? description.zsize : description.zsize / 2f, description.y); robot.addcomponent<rigidbody> (); robot.renderer.material.color = color.green; robot.transform.localscale = new vector3 (description.xsize, description.zsize, description.ysize); robot.transform.rotation = quaternion.euler (0, (float)description.yaw.grad, 0); robot.transform.localscale = new vector3 (30, 30, 30); 

but when try launch nothing in scene. if use cube example

var robot = gameobject.createprimitive(primitivetype.cube); 

i cube. questions how load blender model , create gameobject it?

resources used load assets dynamically downloaded web. if have asset or prefab in project, can link prefab/model file in assets folder script in editor.

public gameobject model; // set in editor void somemethod() {     var robot = gameobject.instantiate (model) gameobject;     robot.transform.position = new vector3 (description.x, description.isround ? description.zsize : description.zsize / 2f, description.y);     robot.addcomponent<rigidbody> ();     robot.renderer.material.color = color.green;     robot.transform.localscale = new vector3 (description.xsize, description.zsize, description.ysize);     robot.transform.rotation = quaternion.euler (0, (float)description.yaw.grad, 0);     robot.transform.localscale = new vector3 (30, 30, 30); } 

Comments