Skip to content

Instantly share code, notes, and snippets.

View paulhayes's full-sized avatar

Paul Hayes paulhayes

View GitHub Profile
@paulhayes
paulhayes / VideoPlayerExtentions.cs
Last active March 31, 2021 14:23
Extends Unity VideoPlayer with methods to display the videos first frame, with with either a yielding coroutine or callback function when the video is ready to be displayed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public static class VideoPlayerExtentions
{
public static void ShowFirstFrame(this VideoPlayer player, System.Action onCompleteCallback)
{
VideoPlayer.FrameReadyEventHandler frameReadyHandler = null;
class AndroidAudio
{
privateprivate static int GetDeviceMaxVolume() {
int streammusic = 3;
return deviceAudio.Call<int>("getStreamMaxVolume", streammusic);
}
private static void SetDeviceVolume(int value) {
int streammusic = 3;
int flagshowui = 0;
{
"questions" : [
{
"question" : "question text",
"intro_video" : {
"video_atlas" : "{filename}",
"sections" : [
{
"key" : "{360|180|screen1|screen2}",
"position" : {"x":0,"y":0,"z":0},
{
"marker" : "{marker_data_file}",
"navigation_object" : "{model_file}",
"questions" :
[
{
"question" :
{
"template" : "{id}",
"text" :
@paulhayes
paulhayes / end.gcode
Last active November 8, 2020 17:40
FLSun QQ Gcode
;End G-Code
M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
M84 ;steppers off
G90 ;absolute positioning
M81
Operating manual
Product features
• High qualify high-definition Images FULL HD1080P DV DC
• Import OV9712 and hd camera
• Compact design, portable handheld DV DC
• Under low illumination hd video recording can be performed
• Video formal for 1280X720P
• Video formal for 1920X1080P
• Mode for taking pictures: 12M(4032X3024)
• Motion detecting video 720P and 1080P
@paulhayes
paulhayes / InterfaceObjectAttribute.cs
Created July 9, 2018 11:01
Really simple utility to allow you to reference UnityEngine.Objects but only of a particular type as inspector fields
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InterfaceObjectAttribute : PropertyAttribute
{
public Type type;
public InterfaceObjectAttribute(Type type){
@paulhayes
paulhayes / ExternalScriptableObject.cs
Created May 23, 2018 16:05
Simple abstract ScriptableObject Class to break settings assets into json file
using System.IO;
using UnityEngine;
public abstract class ExternalScriptableObject : ScriptableObject
{
void OnEnable()
{
string filePath = Path.Combine(Application.dataPath, GetFileName());
if( File.Exists(filePath) ){
JsonUtility.FromJsonOverwrite( File.ReadAllText(filePath), this );
@paulhayes
paulhayes / CoroutineUtil.cs
Last active October 25, 2018 12:19
Concurrent and sequential coroutine helpers. For dual IEnumerators : Sequential, WhileBoth, WhileEither, For n>2 IEnumerators: WhileAny WhileAll Chain. Warning does not work with YieldInstructions
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CoroutineUtil
{
/* Warning these helper methods can generate plenty of garbage memory, use responsibly */
public class WhileBoth : IEnumerator
{
@paulhayes
paulhayes / Logger.cs
Created May 17, 2018 14:56
Simple Logging System
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Logger : ScriptableObject
{
public const int Verbose = (int)Levels.Verbose;
public const int Debug = (int)Levels.Debug;
public const int Info = (int)Levels.Info;