Skip to content

Instantly share code, notes, and snippets.

View ddutchie's full-sized avatar

Gerard Slee ddutchie

  • Tenebris Lab (PTY) LTD
  • Cape Town, South Africa
View GitHub Profile
@ddutchie
ddutchie / Flashlight.mm
Last active March 12, 2024 10:20
Native Flash Light Controller for Unity3D and iOS
#import <AVFoundation/AVFoundation.h>
extern "C" {
void _EnableFlashlight(bool enable) {
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode:enable ? AVCaptureTorchModeOn : AVCaptureTorchModeOff];
[device unlockForConfiguration];
@ddutchie
ddutchie / RayTraceSpeed.cs
Created March 29, 2019 15:07
Speed Of Ray Trace
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class RayTraceSpeed : MonoBehaviour
{
public TMPro.TextMeshProUGUI m_UIPerfText;
Stopwatch m_Stopwatch = new Stopwatch();
int m_UpdateCounter;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
using Unity.Collections;
using System.Diagnostics;
#if UNITY_2018_3_OR_NEWER
using UnityEngine.Rendering;
#else
using UnityEngine;
using UnityEngine.Purchasing;
using UnityEngine.Purchasing.Security;
public class IAPManager : MonoBehaviour, IStoreListener
{
IStoreController controller;
IExtensionProvider extensions;
const string gameID = "com.YourCompany.YourGameID.";
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
[ExecuteInEditMode]
[AddComponentMenu("Layout/Auto Grid Layout Group", 152)]
public class AutoGridLayout : GridLayoutGroup
{
[SerializeField]
private bool m_IsColumn;
[SerializeField]
using UnityEngine;
using UnityEngine.UI;
// attach this to LayoutElement, and it will maintain its aspect.
// Don't use too many of these custom UI scripts (especially nested), since each one lags 1 frame behind,
// when the parent is resized. Also might introduce rect-transform instability, but a couple is ok.
//
// Make sure your LayoutGroup (in parent) has Child controls size ticked, else
// we won't be able to adjust our size!
@ddutchie
ddutchie / ChangeTextToTextMeshPro.cs
Created November 15, 2018 12:50
Vincent's Magic Textmesh Converter
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using TMPro;
class ChangeTextToTextMeshPro : EditorWindow
{
@ddutchie
ddutchie / NewSkyBoxGenerator
Created June 8, 2015 10:16
Initial Tests for Stereo Cubemap Generator.
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
class NewSkyBoxGenerator : MonoBehaviour
{
static int faceSize = 2046;
static string directory = "Assets/Skyboxes";
static string skyboxShader = "RenderFX/Skybox";