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://www.digikey.com/Site/Global/Layouts/DownloadPdf.ashx?pdfUrl=E7EEB830E57D43B09CE51BD7DF0E74D8 | |
| void Start() | |
| { | |
| gyro = Input.gyro; // Store the reference for Gyroscope sensor gyro.enabled = true; //Enable the Gyroscope sensor | |
| } | |
| void Update() | |
| { | |
| if (Time.timeScale != 0) | |
| { |
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
| /** | |
| * Convert From/To Binary/Decimal/Hexadecimal in JavaScript | |
| * https://gist.github.com/faisalman | |
| * | |
| * Copyright 2012-2015, Faisalman <fyzlman@gmail.com> | |
| * Licensed under The MIT License | |
| * http://www.opensource.org/licenses/mit-license | |
| */ | |
| (function(){ |
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
| if (isRunning == true) | |
| { | |
| abortCoRoutine = true; // then inside coroutine loop, check this and yield break; | |
| yield return 0; // need to wait, otherwise startcoroutine starts before previous one ends | |
| } | |
| StartCoroutine(SlideEffectForOldSlide()); |
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/fit-object-exactly-into-perspective-cameras-field-of-view-focus-the-object.496472/#post-6712018 | |
| public static Bounds GetBoundsWithChildren(this GameObject gameObject) | |
| { | |
| Renderer parentRenderer = gameObject.GetComponent<Renderer>(); | |
| Renderer[] childrenRenderers = gameObject.GetComponentsInChildren<Renderer>(); | |
| Bounds bounds = parentRenderer != null | |
| ? parentRenderer.bounds | |
| : childrenRenderers.FirstOrDefault(x => x.enabled).bounds; |
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
| from UnityEngine import GameObject, Vector3, PrimitiveType | |
| from MyScripts import MyCustomClass | |
| for i in xrange(10): | |
| g = GameObject.CreatePrimitive(PrimitiveType.Sphere) | |
| g.name = 'PySphere' + str(i) | |
| g.transform.position = Vector3(i-10, i, 0) | |
| g.AddComponent(MyCustomClass) | |
| c = g.GetComponent(MyCustomClass) | |
| c.someValue = i |
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
| // nothing happens | |
| mytoggle.isOn = false; | |
| // fix: enable [x] Allow Switch Off, in the toggle group |
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 ImageMagick with unity : http://1darray.com/blog/2017/01/27/using-imagemagick-with-unity/ | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using ImageMagick; | |
| public class ImageMagickTest : MonoBehaviour | |
| { | |
| void Start() |
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
| DllNotFoundException: Magick.NET-Q8-x64.Native.dll | |
| ImageMagick.MagickSettings+NativeMagickSettings..ctor () | |
| ImageMagick.MagickSettings..ctor () | |
| ImageMagick.MagickImage..ctor () | |
| ImageMagick.MagickImage..ctor (System.String fileName) | |
| MagicK.CreateWatermark () (at Assets/MagicKNet/MagicK.cs:26) | |
| MagicK.Start () (at Assets/MagicKNet/MagicK.cs:17) | |
| solution: copy missing dll into project root (not inside Assets/, but below it) |
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
| // 2 sided standard surface shader (using 2 passes), with fixed normals for flipped faces | |
| Shader "Custom/TwoSided (FixedNormals)" | |
| { | |
| Properties | |
| { | |
| _Color ("Color", Color) = (1,1,1,1) | |
| _MainTex ("Albedo (RGB)", 2D) = "white" {} | |
| _Glossiness ("Smoothness", Range(0,1)) = 0.5 | |
| _Metallic ("Metallic", Range(0,1)) = 0.0 |