Skip to content

Instantly share code, notes, and snippets.

View WikkidEdd's full-sized avatar

Edd Smith WikkidEdd

View GitHub Profile
@WikkidEdd
WikkidEdd / GraphicRaycasterWithBoundsCheck.cs
Last active March 11, 2022 13:19
Graphic Raycaster with a bound check. For use on world space canvases to improve performance of raycasts. Make sure all your UI elements on within the bounds of the canvas and are co-planar.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class GraphicRaycasterWithBoundsCheck : GraphicRaycaster
{
RectTransform _rectTransform;
RectTransform RectTransform
using UnityEngine;
using System.Collections;
#if DISABLE_DEBUG_LOG
public static class Debug
{
public static new void Log(object message)
{
#if !DISABLE_DEBUG_LOG
@WikkidEdd
WikkidEdd / AppLauncher3D.cs
Last active September 18, 2018 17:38
Build process and asset to add 3d app launchers to Hololens apps. Add AppLauncher3DEditor.cs in to an "Editor" folder. Create a new 3DAppLauncher asset in your project and enter the path to your glb.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName="3DAppLauncher", menuName = "3D App Launcher")]
public class AppLauncher3D : ScriptableObject
{
[Tooltip("Path to glb relative to Assets folder. Include file extension")]
public string _Model;
@WikkidEdd
WikkidEdd / BreakPrefabPermanently.cs
Created September 6, 2018 08:48
Fully break prefab connection so it can't be reconnected. Just put into an Editor folder and you'll find the menu option "GameObject/Break Prefab Instance Permanently"
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class BreakPrefabPermanently
{
[MenuItem("GameObject/Break Prefab Instance Permanently", priority=100)]
static void BreakPrefab()
{
@WikkidEdd
WikkidEdd / UWPLogs.cs
Created August 27, 2018 10:43
Unity script to output to native UWP logs which can then be access via the device portal. Piggy backs on the Microsoft-Windows-Diagnostics-LoggingChannel provider as per this blog post https://blogs.windows.com/buildingapps/2016/06/10/using-device-portal-to-view-debug-logs-for-uwp/
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if NETFX_CORE
using Windows.Foundation.Diagnostics;
#endif
public class UWPLogs : MonoBehaviour {
@WikkidEdd
WikkidEdd / FindSceneRefs.cs
Last active November 19, 2023 11:53
Find references within a scene on a right click context menu for components. As per this tweet https://twitter.com/KarlJamesJones/status/1026756113218371586 Note: Only tested with 2017.4.6
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
using System;
public class FindSceneRefs {
[MenuItem("CONTEXT/Component/Find References In Scene")]
@WikkidEdd
WikkidEdd / CreateSymlinkProject.cs
Last active November 19, 2023 11:45
Creates a symlinked version of a Unity project so you can easily do network development. Add script to Editor folder. Run from "Utils/Create Symlink Project" then choose directory to put symlink'd project in.
using UnityEngine;
using UnityEditor;
using System.Diagnostics;
public class CreateSymlinkProject {
[MenuItem("Utils/Create Symlink Project")]
static void DoIt()
{
string folderName = EditorUtility.SaveFolderPanel("Symlink Project Location", "", "");