Initial Commit

This commit is contained in:
jellejurre
2025-07-19 01:03:02 +02:00
commit e7904e3140
304 changed files with 22521 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 904e122b4614a8c439caa37312b0704d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace DreadScripts.CameraUtility
{
public class CameraUtility
{
private const float SCENE_PIVOT_OFFSET = 1;
[MenuItem("DreadTools/Utility/Camera/Snap Scene To Game")]
public static void SnapSceneViewToGame()
{
if (!TryGetGameCamera(out Camera gc)) return;
SceneView view = SceneView.lastActiveSceneView;
if (YellowLog(view == null, "No Scene View found")) return;
Undo.RecordObject(view, "Snap STG");
view.LookAtDirect(gc.transform.position, gc.transform.rotation, SCENE_PIVOT_OFFSET/2);
view.pivot = gc.transform.position + gc.transform.forward * SCENE_PIVOT_OFFSET;
}
[MenuItem("DreadTools/Utility/Camera/Snap Game To Scene")]
public static void SnapGameViewToScene()
{
if (!TryGetGameCamera(out Camera gc)) return;
if (!TryGetSceneCamera(out Camera sc)) return;
Undo.RecordObject(gc.transform, "Snap GTS");
gc.transform.SetPositionAndRotation(sc.transform.position, sc.transform.rotation);
}
private static bool TryGetGameCamera(out Camera gameCamera)
{
gameCamera = Camera.main ?? Object.FindObjectOfType<Camera>();
return !YellowLog(!gameCamera, "No Camera found in scene");
}
private static bool TryGetSceneCamera(out Camera sceneCamera)
{
sceneCamera = SceneView.lastActiveSceneView?.camera;
return !YellowLog(!sceneCamera, "No Scene View found");
}
private static bool YellowLog(bool condition, string msg)
{
if (condition) Debug.LogWarning($"<color=yellow>[CameraUtility] {msg}</color>");
return condition;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e230c2bf340461c46939efc284f6bf22
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
{
"name": "com.dreadscripts.camerautility.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: acb80353a76f6c0488836f3e26ef1785
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

21
CameraUtility/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Dreadrith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c6d418ac183680543906fe0d17a02a3a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
CameraUtility/README.md Normal file
View File

@@ -0,0 +1,16 @@
# Camera Utility
### [Download From Here](https://vpm.dreadscripts.com/)
![image](https://i.imgur.com/5fow365.gif)
## Features
- Snap the Scene view to the position and rotation of the Game view camera or vice versa.
## How to Use
1. Open the Unity Editor.
2. Navigate to `DreadTools > Utility > Camera` in the top menu.
3. Choose either "Snap Scene To Game" or "Snap Game To Scene" to synchronize views accordingly.
### Thank You
If you enjoy Camera Utility, please consider [supporting me ♡](https://ko-fi.com/Dreadrith)!

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: df3ef724ecd912644ab09c0dd1490ca1
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
{
"name": "com.dreadscripts.camerautility",
"displayName": "DreadScripts - CameraUtility",
"version": "1.0.1",
"description": "Simple menu item to snap Game View to Scene View or vice versa.",
"gitDependencies": {},
"vpmDependencies": {},
"author": {
"name": "Dreadrith",
"email": "dreadscripts@gmail.com",
"url": "https://www.dreadrith.com"
},
"legacyFolders": {},
"legacyFiles": {},
"type": "tool",
"unity": "2019.4"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c08baa384bf219b4494368267dea3617
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: