P
P
polyakovyevgeniy2016-10-12 00:24:35
Unity
polyakovyevgeniy, 2016-10-12 00:24:35

How to load .fbx from local folder?

Please tell me the code to load the .fbx file from the package on the computer (if possible, not from Resources), and instantiate it on the stage.
There is this code:

Mesh mesh =  (Mesh)Resources.Load("Fan_Done8", typeof(Mesh));
        Instantiate(mesh, new Vector3(0, 0, 0), Quaternion.identity);

But for some reason the object does not appear on the stage.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2016-10-12
@polyakovyevgeniy

Unity does not know how to work with fbx directly, the editor converts models to its own format during import. Therefore, at runtime, meshes can only be loaded from resources or asset bundles. Some plugins flashed in the store, but fbx is a closed format, so don't count on much.
In order for something to appear on the screen, one model is not enough, you also need a renderer and material. You need to either create a GameObject with code and attach the necessary components to it, or instantiate a prefab and push a model into it.
Read the manual, it will become clearer:
https://docs.unity3d.com/Manual/Prefabs.html
https://docs.unity3d.com/Manual/LoadingResourcesat...
https://docs.unity3d.com/Manual/InstantiatingPrefa ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question