New Plugin Game Objects

  • The old Plugin API had 3 classes to create custom elements in the world: The World3DModel class (to spawn a custom 3d model), the World3DText class (to spawn a 3d text) and the WorldArea class (to visualize an Area). They had a few limitations, e.g. no child-parent handling (i.e. you couldn't attach a world element as child to another element), models only consisted of a single mesh + texture etc.


    We have now reworked this part for the new API: There is a base class GameObject, which represents an empty (invisible) element in the world. You can add a collider to it, or also attach other game objects as child (similar to how the child-parent handling works for UI elements).



    There is a derived Model class, which accepts a mesh and a material asset - this is useful if you want to spawn basic elements (e.g. primitive elements like a cube), or procedurally generated meshes. There is also a derived Prefab class: It represents a more complex 3d model. You can create a prefab in Unity, then load it in the API. The good thing is, that a prefab may contain an arbitrary number of meshes / submeshes, custom material and shaders and also custom Unity components. This way you could even create particle effects, animations, physical objects etc. directly in Unity, export them to an AssetBundle and load them through the Plugin API.


    If you have a model consisting of several textures and submeshes, you can now easily import it into Unity, export it to an AssetBundle and load it as Prefab through the API - so you no longer have to deal with the "only 1 mesh and 1 texture" limitation of the old Java API.


    The Prefab class also enables you to access any sub element and component, so you could always change a material or animator parameter or modify a visual effect.




    Of course there is a Text3D class too, which is also derived from GameObject and simply represents a 3D text (similar to how it worked in the Java version).

  • red51

    Approved the thread.
  • Deutsch / German:


    Die alte Plugin-API hatte 3 Klassen, um benutzerdefinierte Elemente in der Welt zu erstellen: Die World3DModel-Klasse (um ein benutzerdefiniertes 3D-Modell zu erzeugen), die World3DText-Klasse (um einen 3D-Text zu erzeugen) und die WorldArea-Klasse (um einen Bereich zu visualisieren).


    Wir haben diesen Teil nun für die neue API überarbeitet: Es gibt eine Basisklasse GameObject , die ein leeres (unsichtbares) Element in der Welt darstellt. Sie können ihm einen Collider hinzufügen oder auch andere Spielobjekte als Kind anhängen (ähnlich wie die Kind-Eltern-Behandlung für UI-Elemente funktioniert).


    Es gibt eine abgeleitete Model-Klasse, die ein Netz und ein Materialobjekt akzeptiert - dies ist nützlich, wenn Sie grundlegende Elemente (z. B. primitive Elemente wie einen Würfel) oder prozedural generierte Netze erzeugen möchten.

    Es gibt auch eine abgeleitete Prefab-Klasse: Es stellt ein komplexeres 3D-Modell dar. Sie können ein Prefab in Unity erstellen und es dann in die API laden. Das Gute daran ist, dass ein Prefab eine beliebige Anzahl von Meshes / Submeshes, benutzerdefinierten Materialien und Shadern sowie benutzerdefinierten Unity-Komponenten enthalten kann. Auf diese Weise können Sie sogar Partikeleffekte, Animationen, physische Objekte usw. direkt in Unity erstellen, in ein AssetBundle exportieren und über die Plugin-API laden.


    Wenn Sie ein Modell haben, das aus mehreren Texturen und Submeshes besteht, können Sie es jetzt ganz einfach in Unity importieren, in ein AssetBundle exportieren und als Prefab über die API laden - Sie müssen sich also nicht mehr mit "nur 1 Mesh und 1 texture"-Beschränkung der alten Java-API.


    Die Prefab-Klasse ermöglicht Ihnen auch den Zugriff auf jedes Unterelement und jede Komponente, sodass Sie jederzeit einen Material- oder Animatorparameter oder einen visuellen Effekt ändern können.



    Natürlich gibt es auch eine Text3D-Klasse, die ebenfalls von GameObject abgeleitet ist und einfach einen 3D-Text darstellt (ähnlich wie es in der Java-Version funktioniert hat).

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!