Attention

You are viewing PyUnity docs under the develop branch. As such, they are only applicable if you installed from source. Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent release.

pyunity.loader module


Utility functions related to loading and saving PyUnity meshes and scenes.

This will be imported as pyunity.Loader.

pyunity.loader.LoadObj(filename)[source]

Loads a .obj file to a PyUnity mesh.

Parameters

filename (str) – Name of file

Returns

A mesh of the object file

Return type

Mesh

pyunity.loader.SaveObj(mesh, path)[source]
pyunity.loader.LoadStl(filename)[source]
pyunity.loader.LoadMesh(filename)[source]

Loads a .mesh file generated by SaveMesh(). It is optimized for faster loading.

Parameters

filename (str) – Name of file relative to the cwd

Returns

Generated mesh

Return type

Mesh

pyunity.loader.SaveMesh(mesh, path)[source]

Saves a mesh to a .mesh file for faster loading.

Parameters
  • mesh (Mesh) – Mesh to save

  • path (str or Path) – Path to save file

class pyunity.loader.Primitives[source]

Bases: object

Primitive preloaded meshes. Do not instantiate this class.

cube = <pyunity.meshes.Mesh object>

Type:    Mesh

quad = <pyunity.meshes.Mesh object>

Type:    Mesh

doubleQuad = <pyunity.meshes.Mesh object>

Type:    Mesh

sphere = <pyunity.meshes.Mesh object>

Type:    Mesh

capsule = <pyunity.meshes.Mesh object>

Type:    Mesh

cylinder = <pyunity.meshes.Mesh object>

Type:    Mesh

pyunity.loader.GetImports(file)[source]
pyunity.loader.parseString(string, project=None)[source]
pyunity.loader.parseStringFallback(string, project, fallback)[source]
class pyunity.loader.ObjectInfo[source]

Bases: object

class SkipConv[source]

Bases: object

static convString(v)[source]
pyunity.loader.SaveMat(material, project, filename)[source]
pyunity.loader.LoadMat(path, project)[source]
pyunity.loader.SavePrefab(prefab, path, project)[source]
pyunity.loader.LoadPrefab(path, project)[source]
pyunity.loader.savable = (<class 'pyunity.meshes.Color'>, <class 'pyunity.values.vector.Vector3'>, <class 'pyunity.values.quaternion.Quaternion'>, <class 'bool'>, <class 'int'>, <class 'str'>, <class 'float'>, <class 'list'>, <class 'tuple'>, <class 'pyunity.core.SavesProjectID'>, <class 'pyunity.loader.ObjectInfo.SkipConv'>)

Type:    tuple

All savable types that will not be saved as UUIDs

pyunity.loader.SaveGameObjects(gameObjects, data, project)[source]
pyunity.loader.LoadObjectInfos(file)[source]
pyunity.loader.instanceCheck(type_, value)[source]
pyunity.loader.GetComponentMap()[source]
pyunity.loader.LoadGameObjects(data, project)[source]
pyunity.loader.SaveScene(scene, project, path)[source]
pyunity.loader.ResaveScene(scene, project)[source]
pyunity.loader.GenerateProject(name, force=True)[source]
pyunity.loader.SaveProject(project)[source]
pyunity.loader.LoadProject(folder, remove=True)[source]
pyunity.loader.LoadScene(sceneFile, project)[source]