Creating Objects for Varwin in Unity¶
Video Guides¶
Here you will find the video guides showing how to create objects for the Varwin RMS platform.
Creating a Button
Creating a Light Bulb
Creating a Screen
Creating objects¶
- Create or import a game object and save it as a prefab.
- Select the prefab in its folder.
- Open VARWIN SDK -> Create -> Object

- Select an object, name it. Add tags for fast search. Fill in the info about the object’s author.
- Click Create. You’ll be asked to wait several moments.

- Your object has been created. It consists of: a. object prefab, b. .asmdef file (for object code compilation), c. object class stored in a unique namespace. Should the need arise to add more classes, they will have to be stored in the same directory and the same namespace.

- SimpleButton class has been created for the object. It inherits VarwinObject. This is the main object class, which connects the object with the platform.
using UnityEngine;
using Varwin.Public;
namespace Varwin.Types.Cube_68bc9ae493d843aab141939fcd529513
{
[Locale(SystemLanguage.English,"Cube")]
[Locale(SystemLanguage.Russian,"Cube")]
public class Cube : VarwinObject
{
void Start()
{
}
void Update()
{
}
}
}
- Everything is ready for writing object code.
Example¶
The object has a method “ChangeState” in its main class. The method changes bool variable IsPressed.
public void ChangeState()
{
isPressed = !isPressed;
_animator.SetBool("Pressed", isPressed);
To connect this method with the action of pulling the trigger on a controller (“Use”): select method “ChangeState” in Interactable Object Behavior.

You will have to create a function for Blockly, write an attribute for it (in this case, Checker) and name it.
[Checker("buttonState")]
[Locale(SystemLanguage.English, "button pressed")]
public bool ButtonPressedChecker()
{
return isPressed;
}
Should this object have several methods, Blockly will group them within one block within this name.
- E.g., if we create another state of the button, “is released”,
[Checker("pressed")]
[Locale(SystemLanguage.English, "is released")]
public bool IsReleased()
{
return !IsPressed;
}
- Blockly will group these methods this way:

Everything is ready for object building. Click Build.

When the object is ready, the folder containing it will open. Now you can upload the object into the Varwin library.

The object appears in the library.

Now you can place the object into a scene in VR. Click Save. Now the object appears in the scene. Open Blockly. You’ll see logic blocks that have been created for the object.


Working with attributes¶
Ways of working with attributes are described here: Working with attributes
Objects, scene templates versioning¶
Create new versions of existing objects and scene templates.