Class PrefabAsset

java.lang.Object
net.risingworld.api.assets.Asset
net.risingworld.api.assets.PrefabAsset

public final class PrefabAsset extends Asset
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
  • Method Details

    • loadFromGame

      public static PrefabAsset loadFromGame(String path)
      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

      public static PrefabAsset loadFromAssetBundle(AssetBundle bundle, String path)
      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

      public static PrefabAsset loadFromFile(String file)
      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

      public static PrefabAsset loadFromFile(String file, ModelImportSettings settings)
      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.