| 更新: | 2018-08-20 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 18.8.3 |
| URL: | https://voluntas.github.io/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.Video; | |
| public class SmoothVideoPlaylist : MonoBehaviour { | |
| // to smoothly cut between two videos, we need two VideoPlayers | |
| // make sure you create two VideoPlayers and assign them in the Inspector | |
| public VideoPlayer activeCam, otherCam; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Runtime.InteropServices; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| public class KeyboardEventArgs : EventArgs | |
| { | |
| public int KeyCode { get; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame) | |
| { | |
| Matrix4x4 cameraToWorldMatrix; | |
| photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix); | |
| Matrix4x4 projectionMatrix; | |
| photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix); | |
| var imagePosZeroToOne = new Vector2(pixelPos.x / imageWidth, 1 - (pixelPos.y / imageHeight)); | |
| var imagePosProjected = (imagePosZeroToOne * 2) - new Vector2(1, 1); // -1 to 1 space |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.XR; | |
| using UnityEngine.XR.Management; | |
| public class XRSubSystemTest : MonoBehaviour | |
| { | |
| public void Start() | |
| { | |
| var xrSettings = XRGeneralSettings.Instance; | |
| if (xrSettings == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const Builder = std.build.Builder; | |
| const Step = std.build.Step; | |
| pub fn build(b: *Builder) void { | |
| const target = b.standardTargetOptions(.{}); | |
| const mode = b.standardReleaseOptions(); | |
| const exe = b.addExecutable("hw", "hw.zig"); | |
| exe.setTarget(target); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEditor; | |
| /// <summary> | |
| /// This editor utility can lock/unlock unity script compile from menu item. | |
| /// See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile | |
| /// </summary> | |
| public static class CompileLocker | |
| { | |
| [MenuItem("Compile/Lock", false, 1)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.Rendering; | |
| using UnityEngine.Rendering.Universal; | |
| public class GrabScreenFeature : ScriptableRendererFeature | |
| { | |
| [System.Serializable] | |
| public class Settings |
There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty.
string? hello = "hello world";