Package net.risingworld.api.assets
Class PrefabAsset
java.lang.Object
net.risingworld.api.assets.Asset
net.risingworld.api.assets.PrefabAsset
Represents a prefab. A prefab may consist of several meshes. You can prepare a prefab in Unity, so it may also
contain custom materials (including custom shaders), lights, particle effects etc.
Supported file formats: zip, fbx, obj, stl, ply, 3mf, gltf
Supported file formats: zip, fbx, obj, stl, ply, 3mf, gltf
-
Nested Class Summary
Nested classes/interfaces inherited from class net.risingworld.api.assets.Asset
Asset.Source, Asset.Type
-
Field Summary
Fields inherited from class net.risingworld.api.assets.Asset
DEFAULT_EXTENSION
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrefabAsset
loadFromAssetBundle
(AssetBundle bundle, String path) Loads a prefab from an AssetBundle.static PrefabAsset
loadFromFile
(String file) Loads a prefab from a file.static PrefabAsset
loadFromFile
(String file, ModelImportSettings settings) Loads a prefab from a file.static PrefabAsset
loadFromGame
(String path) Loads a prefab from the game assets.Methods inherited from class net.risingworld.api.assets.Asset
dispose, equals, getChecksum, getDependency, getExtension, getHandle, getPath, getSource, getType, hashCode, isDisposed
-
Method Details
-
loadFromGame
Loads a prefab from the game assets. This is quite efficient because the server doesn't have to send any data to the clients.- Parameters:
path
- the path to the game prefab.- Returns:
- a new prefab asset instance.
-
loadFromAssetBundle
Loads a prefab from an AssetBundle.- Parameters:
bundle
- the asset bundle you want to load the prefab from.path
- the path in the asset bundle.- Returns:
- a new prefab asset instance.
-
loadFromFile
Loads a prefab from a file. This could be an fbx, obj or any other model file. If your model contains any textures you want to load automatically, it's recommended to put them into a zip file (together with the model file) and load the zip file.- Parameters:
file
- the path to the model file.- Returns:
- a new prefab asset instance.
-
loadFromFile
Loads a prefab from a file. This could be an fbx, obj or any other model file. If your model contains any textures you want to load automatically, it's recommended to put them into a zip file (together with the model file) and load the zip file.- Parameters:
file
- the path to the model file.settings
- a settings object which enables you to influence how the model should be loaded.- Returns:
- a new prefab asset instance.
-