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
//Get instance, guid, and file ID of file during play mode | |
//Possibly useful for getting the type or instance of a specific file in the project folder and possibly loading | |
//This script prints these details for a selected asset in project window | |
using System.Text; | |
using UnityEngine; | |
using UnityEditor; | |
class ShowAssetIds | |
{ |
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; | |
using System.Collections; | |
using System.Collections.Generic; | |
[CustomEditor(typeof(Transform))] | |
public class keepTransformEditor : UnityEditor.Editor | |
{ | |
//... | |
public override void OnInspectorGUI() |
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
public static unsafe void CopyToFast<T>(this NativeArray<T> nativeArray, T[] array) where T : struct { | |
int byteLength = nativeArray.Length * UnsafeUtility.SizeOf(typeof(T)); | |
void* managedBuffer = UnsafeUtility.AddressOf(ref array[0]); | |
void* nativeBuffer = nativeArray.GetUnsafePtr(); | |
UnsafeUtility.MemCpy(managedBuffer, nativeBuffer, byteLength); | |
} | |
// Usage | |
NativeArray<Vector3> nativeVertices = new NativeArray<Vector3>(vertexCount, Allocator.Persistent); | |
Vector3[] managedVertices = new Vector3[vertexCount]; |
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
/**************************************************************** | |
GestureTest.ino | |
APDS-9960 RGB and Gesture Sensor | |
Shawn Hymel @ SparkFun Electronics | |
May 30, 2014 | |
https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor | |
Tests the gesture sensing abilities of the APDS-9960. Configures | |
APDS-9960 over I2C and waits for gesture events. Calculates the | |
direction of the swipe (up, down, left, right) and displays it |