Collection of quick scripts, shaders, and materials for prototyping.
You can install this package from the Package Manager directly:
- Open the Unity Package Manager Window (
Window
->Package Manager
) - Click on
+
->Add package from git URL
- Paste the HTTPS git url of the package:
https://github.com/Yakvi/unitypackage-proto.git
and selectAdd
If you would like to modify the package to your needs, you can clone this project as a submodule. The snippet below presumes that your your git repository is inside your Unity project:
~/[Your project git folder] git submodule add https://github.com/yakvi/unitypackage-proto Packages/com.venetstudio.proto
Simple mouse pointer. Has two modes:
- World plane (with Y position of 0)
- Physics collision (collides with everything)
Adds WASD controls to the camera, as well as Q/E for rotation and wheel for zoom.
Event-based input processing. Provides events for:
static OnClick
: called when mouse 0 is released.static OnRightClick
: called when mouse 1 is released.
Tracks and exposes input for:
static bool mousePosInvalid
: Validation of mouse position (whether or not mouse is in game bounds)static Vector3 mousePos
: X and Y store screen mouse position, Z unused.static Vector3 mousePosOnClickStart
: CachedmousePos
, only updates when the mouse 0 gets pressed.static float mouseWheel
: Mouse wheel delta from the last frame.static Vector3 movement
: X and Z store horizontal/vertical axis. Y stores Q/E state.
The input center also allows custom hotkey processing. Keys can be bound using the BindHotkey
and UnbindHotkey
methods. The user can specify if the hotkey should be processed on release on while it's pressed.
All the utility functions are stored in the static class VenetStudio.Utility
. As such, they can be shortcut if you
add using static VenetStudio.Utility
.
- Camera (
MouseUtils.cs
)Camera GetMainCam()
: caches and returns the main camera.Transform GetMainCamTransform()
: caches and returns main camera transform.Vector3 GetCameraPos()
: returns the main camera position. The value is cached every frame.
- Mouse (
MouseUtils.cs
)bool IsMouseOverUi()
: Inverse shortcut forEventSystem.current.IsPointerOverGameObject()
.Vector3 GetMousePhysicsPos(int LayerMask)
: returns 3D mouse position based on provided Physics mask. By default the mask is "Everything". The value is cached every frame.- Note: currently, only the first queried mask is cached and returned each frame.
bool GetMousePhysicsHit(out RaycastHit hit, int layerMask)
: Same asGetMousePhysicsPos
, more explicit. thebool
value makes sure that the collision is valid and that there was no UI.- Note: currently, only the first queried mask is cached and returned each frame.
static Vector3 GetMousePlanePos()
: Returns mouse position on theup, 0
plane. The value is cached every frame.static bool TryGetWorldMousePlanePos(out Vector3 mousePos)
: Same asGetMousePlanePos
, except it verifies if mouse is over UI.
- Time (
MouseUtils.cs
)static float GetDeltaTime()
Returns delta time. The value is cached every frame.
- Physics (
PhysicsUtils.cs
)bool Raycast(Vector3 position, Vector3 direction, float maxDistance, LayerMask mask)
: Currently, identical toPhysics.Raycast
.static bool Raycast(Ray ray, out RaycastHit hit, float maxDistance, LayerMask mask)
: Currently, identical toPhysics.Raycast
.static int OverlapSphere(Vector3 center, float radius, Collider[] results, int mask = ~0)
: Currently, identical toPhysics.OverlapSphere
.
- Random number generation (
RandomUtils.cs
)float GetRandom(float min, float max)
: Currently, identical toRandom.Range
;int GetRandom(int min, int max)
: Currently, identical toRandom.Range
;
GridGlobal
: A shader that draws texture in a grid pattern in world spaceGridObject
: A shader that draws texture in a grid pattern in object spaceGlassGlobal
: A glassy shader, texture is projected in world spaceGlassObject
: A glassy shader, texture is projected in object space
Enabled components:
- Tonemapping
- Color Adjustments
- Bloom
- Vignette
- Film Grain
- Split Toning
Venet_High_URP profile is mostly identical to the default High URP profile. The only difference are some minor tweaks to ambient occlusion.