Preview image of screenshot in handmenu

story_process
Nadine Ganz 2024-07-15 15:55:13 +02:00
parent b7dbe4c03e
commit e2a9832c80
6 changed files with 1773 additions and 20 deletions

View File

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

View File

@ -1 +1 @@
2024-06-21T15:02:41.9357660Z 2024-07-15T13:48:15.1894300Z

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,12 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System; using System;
using UnityEngine.UI;
public class Screenshot : MonoBehaviour public class Screenshot : MonoBehaviour
{ {
// Start is called before the first frame update [SerializeField]
void Start() RawImage _previewImg;
{
}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
@ -28,10 +26,29 @@ public class Screenshot : MonoBehaviour
StartCoroutine(TakeScreenshot()); StartCoroutine(TakeScreenshot());
} }
public void OnClickPreview()
{
StartCoroutine(CreatePreview());
}
public void DestroyPreviewTexture()
{
if (_previewImg.texture == true)
{
Destroy(_previewImg.texture);
}
}
IEnumerator TakeScreenshot() IEnumerator TakeScreenshot()
{ {
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
string timpStamp = DateTime.Now.ToString("ddMMyyyyHHmmssffff"); string timpStamp = DateTime.Now.ToString("ddMMyyyyHHmmssffff");
ScreenCapture.CaptureScreenshot("snapshot_" + timpStamp + ".png"); ScreenCapture.CaptureScreenshot("snapshot_" + timpStamp + ".png");
} }
IEnumerator CreatePreview()
{
yield return new WaitForEndOfFrame();
_previewImg.texture = ScreenCapture.CaptureScreenshotAsTexture();
}
} }

View File

@ -5,12 +5,12 @@ EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1
path: Assets/Scenes/1.0-SBB.unity
guid: 6a1144d40bbf04513a9929856271d4e7
- enabled: 1 - enabled: 1
path: Assets/Scenes/Test-HandInteraction.unity path: Assets/Scenes/Test-HandInteraction.unity
guid: 6560c631efa4b492689f76d06071d916 guid: 6560c631efa4b492689f76d06071d916
- enabled: 1
path: Assets/Scenes/1.0-SBB.unity
guid: 6a1144d40bbf04513a9929856271d4e7
- enabled: 1 - enabled: 1
path: Assets/Scenes/Test-Scene.unity path: Assets/Scenes/Test-Scene.unity
guid: 5739d873cf7d24221bea4b568b59f9c1 guid: 5739d873cf7d24221bea4b568b59f9c1

View File

@ -140,6 +140,9 @@ PlayerSettings:
bundleVersion: 0.1 bundleVersion: 0.1
preloadedAssets: preloadedAssets:
- {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2} - {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2}
- {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260, type: 2}
- {fileID: -8196854396901781169, guid: 1a4c68ca72a83449f938d669337cb305, type: 2}
- {fileID: -64324148185763206, guid: a9a6963505ddf7f4d886008c6dc86122, type: 2}
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1 m_HolographicPauseOnTrackingLoss: 1