- scan your legos to get ideas https://apps.apple.com/dk/app/brickit-rebuild-your-lego/id1477221636
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
| var volume = go.GetComponent<PostProcessVolume>(); | |
| AmbientOcclusion ambientOcclusionLayer = null; | |
| volume.profile.TryGetSettings(out ambientOcclusionLayer); | |
| var ff = ambientOcclusionLayer.radius; | |
| ff.value = ambientOcclusionLayer.radius / (float)scale; | |
| // http://answers.unity.com/answers/1483341/view.html |
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
| // https://forum.unity.com/threads/compile-times-twice-as-long-then-previous-versions.1123711/ | |
| using UnityEngine; | |
| using UnityEditor; | |
| using System.Collections; | |
| class CompileTime : EditorWindow { | |
| bool isTrackingTime; | |
| double startTime, finishTime, compileTime; | |
| [MenuItem("Window/Compile Times")] | |
| public static void Init() { |
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
| // https://forum.unity.com/threads/bitmap-matrix-from-texture2d.717428/ | |
| static Bitmap_p ConvertTexture(Texture2D texture) | |
| { | |
| var original = texture.GetPixels32(); | |
| byte[] result = new byte[texture.width * texture.height]; | |
| for (int i = 0; i < original.Length; i++) | |
| { | |
| if(original[i].r + original[i].g + original[i].b < Treshold * 255 * 3) | |
| { |
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
| // https://answers.unity.com/questions/52664/how-would-one-calculate-a-3d-mesh-volume-in-unity.html?childToView=52733#answer-52733 | |
| using UnityEngine; | |
| public class MeshVolume : MonoBehaviour | |
| { | |
| void Start() | |
| { | |
| Mesh mesh = GetComponent<MeshFilter>().sharedMesh; | |
| float volume = VolumeOfMesh(mesh); |
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
| var path = Path.Combine(path, exe); | |
| ProcessStartInfo startInfo = new ProcessStartInfo(path); | |
| startInfo.Arguments =""; | |
| startInfo.UseShellExecute = false; | |
| System.Diagnostics.Process.Start(startInfo); | |
| // launch hidden or minimized | |
| var path = Path.Combine(path, exe); | |
| ProcessStartInfo startInfo = new ProcessStartInfo(path); | |
| startInfo.Arguments =""; |
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
| // https://forum.unity.com/threads/generating-sprites-dynamically-from-png-or-jpeg-files-in-c.343735/ | |
| using UnityEngine; | |
| using System.Collections; | |
| using System.IO; | |
| public class IMG2Sprite : MonoBehaviour | |
| { | |
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
| // https://forum.unity.com/threads/unwanted-editor-hotkeys-in-game-mode.182073/#post-6886781 | |
| using UnityEditor; | |
| using UnityEditor.ShortcutManagement; | |
| [InitializeOnLoad] | |
| public static class EnterPlayModeBindings | |
| { | |
| static EnterPlayModeBindings() | |
| { | |
| EditorApplication.playModeStateChanged += ModeChanged; |
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
| // add Physics raycaster to main camera | |
| // add EventSystem gameobject on scene | |
| // attach this script to gameobject with 3D collider | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.EventSystems; | |
| public class Target : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler | |
| { |
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
| // https://forum.unity.com/threads/user-image-download-from-in-webgl-app.474715/#post-3698248 | |
| [DllImport("__Internal")] | |
| private static extern void DownloadFile(byte[] array, int byteLength, string fileName); | |
| var texture = ScreenCapture.CaptureScreenshotAsTexture(); | |
| byte[] textureBytes = texture.EncodeToPNG(); | |
| DownloadFile(textureBytes, textureBytes.Length, "screenshot.png"); | |
| Destroy(texture); |