Overview
Rainity is a helpful package that allows you to display Unity scenes on your Windows desktop with ease. Create interactive wallpapers that display over or under your desktop icons, or use Rainity’s API to retrieve information from your computer! Rainity’s name and idea is based off of Rainmeter, a Windows desktop customization tool.
Rainity API
Aside from the main Rainity script component, Rainity’s API is a powerful way to customize your desktop application. Functions include getting system performance counters, getting file icons and the desktop wallpaper image as Texture2D’s, simulating keypresses and more. Documentation is included in the package as a .PDF or can be found online here.
Compatibility
This package only operates on Windows computers due to its WinAPI calls. Unity 2018.1.0 and higher are the versions that work with Rainity since the .NET 4.x scripting runtime was officially supported in that version.
Open files and directories using the default program (Rainity.OpenFile(string fileName))
Get weather information including the city name, temperature, 7-day forecast, atmosphere, wind speed, current outside conditions, and more. (Rainity.GetWeatherInformation())
You can open files/directories/programs using Rainity.OpenFile(string fileName). However, command-line arguments aren’t supported yet, but they will be in the next update.
Nice asset Playing around with it and got relatively quick up to speed. It does not like VR headsets attached functioning as a third monitor. You need to disable the VR monitor before Rainity works fully. Otherwise it’s going to show over that VR monitor as well. Perhaps an idea (if possible) could be to select which screens Rainity should display on.
Hi,
This is a great asset! The simplicity and the features gave me some new creation ideas already.
However for my project I need to be able to pick and drag rigidbodies around with the mouse when the app is running behind desktop icons.
I got this script from SharpCoder and edited it so it uses Rainity input system. It works fine in the editor but not in the build when the “Behind Icons” option is on…
using UnityEngine;
public class SC_DragRigidbody : MonoBehaviour
{
public float forceAmount = 500;
Rigidbody selectedRigidbody;
Camera targetCamera;
Vector3 originalScreenTargetPosition;
Vector3 originalRigidbodyPos;
float selectionDistance;
// Start is called before the first frame update
void Start()
{
targetCamera = GetComponent<Camera>();
}
void Update()
{
if (!targetCamera)
return;
if (RainityInput.GetMouseButtonDown(0))
{
//Check if we are hovering over Rigidbody, if so, select it
selectedRigidbody = GetRigidbodyFromMouseClick();
}
if (RainityInput.GetMouseButtonUp(0) && selectedRigidbody)
{
//Release selected Rigidbody if there any
selectedRigidbody = null;
}
}
void FixedUpdate()
{
if (selectedRigidbody)
{
Vector3 mousePositionOffset = targetCamera.ScreenToWorldPoint(new Vector3(RainityInput.mousePosition.x, RainityInput.mousePosition.y, selectionDistance)) - originalScreenTargetPosition;
selectedRigidbody.velocity = (originalRigidbodyPos + mousePositionOffset - selectedRigidbody.transform.position) * forceAmount * Time.deltaTime;
}
}
Rigidbody GetRigidbodyFromMouseClick()
{
RaycastHit hitInfo = new RaycastHit();
Ray ray = targetCamera.ScreenPointToRay(RainityInput.mousePosition);
bool hit = Physics.Raycast(ray, out hitInfo);
if (hit)
{
if (hitInfo.collider.gameObject.GetComponent<Rigidbody>())
{
selectionDistance = Vector3.Distance(ray.origin, hitInfo.point);
originalScreenTargetPosition = targetCamera.ScreenToWorldPoint(new Vector3(RainityInput.mousePosition.x, RainityInput.mousePosition.y, selectionDistance));
originalRigidbodyPos = hitInfo.collider.transform.position;
return hitInfo.collider.gameObject.GetComponent<Rigidbody>();
}
}
return null;
}
}
This is a script you attach to the camera.
Do you have any clue on why dragging with the left mouse button just doesn’t work? Have you already achieved this in an other way?
EDIT: It actually seems to be related to the fact that I have a dual screen.
If you use Easy save, for dynamic settings and things, don’t use Auto Save functions. They seem to break, or interupt, some things Rainity is doing and instead of the application becoming the background it becomes a foreground application.