Skip to content

Instantly share code, notes, and snippets.

View Novack's full-sized avatar

Novack

View GitHub Profile
using System;
using UnityEditor;
public class CopyPasteValues
{
const string kBufferName = "json-copy-buffer";
const string kTypeName = "json-copy-type";
[MenuItem("CONTEXT/Component/Copy Values With Json")]
static void Copy(MenuCommand command)
@gekidoslair
gekidoslair / EditorNote.cs
Last active May 30, 2020 16:51
Add to any gameobject to provide scene-view annotations
using UnityEditor;
using UnityEngine;
namespace PixelWizards.Utilities
{
public class EditorNote : MonoBehaviour
{
[TextArea]
public string m_Text;
public Vector3 m_Offset;
/// <summary>
/// Supports drawing properties for lists.
/// </summary>
/// <typeparam name="TData"></typeparam>
abstract class PropertyDrawerExtended<TData> : PropertyDrawer
{
Dictionary<string, TData> m_PropertyData = new Dictionary<string, TData>();
TData GetDataForProperty(SerializedProperty property)
{
@unitycoder
unitycoder / unity-workflow-issues.md
Last active May 9, 2024 15:52
Unity WorkFlow Issues And Bugs

RANDOM (TO BE SORTED..Latest issues at bottom, maybe more relevant)

  • Folded box colliders keep unfolding here and there
  • No alpha in generated Sprite (circle) when assigned to UI Image
  • Never know for sure what version works best with VR and post processing..
  • Sprite slicer doesnt work with small sprites (support said wont fix)
  • Shadergraph: how to move node with all its connected parent nodes?
  • Tried to update oculus package, failed due to dll in use, restarting didnt help, deleted whole oculus folder, alt tab and back, deleted folder appread back! (multiple tiles, until deleted library and some other folder also)
  • Cannot drag objects to another folder, if target folder already contains same filename, but there is no info to user that its the case
  • More than once a week, sign into unity dialog
  • Doing multiselect DeSelect in project window, it jumps to first item on every deselect
@D4koon
D4koon / BitmapToIcon.cs
Last active March 21, 2024 14:48
Create a Icon that calls DestroyIcon() when the Destructor is called.
public class IconExtensions
{
/// <summary>
/// Create a Icon that calls DestroyIcon() when the Destructor is called.
/// Unfortunatly Icon.FromHandle() initializes with the internal Icon-constructor Icon(handle, false), which sets the internal value "ownHandle" to false
/// This way because of the false, DestroyIcon() is not called as can be seen here:
/// https://referencesource.microsoft.com/#System.Drawing/commonui/System/Drawing/Icon.cs,f2697049dea34e7c,references
/// To get arround this we get the constructor internal Icon(IntPtr handle, bool takeOwnership) from Icon through reflection and initialize that way
/// </summary>
private static Icon BitmapToIcon(Bitmap bitmap)
@unitycoder
unitycoder / DebugLogColor.cs
Created February 18, 2020 09:49
Debug.Log with Color
Debug.Log("<color=#" + ColorUtility.ToHtmlStringRGB(col) + ">████████████</color> = " + col);
@JohannesDeml
JohannesDeml / README.md
Last active October 1, 2025 13:34
Remove Unity mobile notification warning for WebGL builds

Remove warning

Unity shows the following warning on mobile devices up to Unity 2019.4: "Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway." This script helps you remove this warning

Live example

To see live examples see Unity Web GL Loading Test

Logic

The script will run after the build has completed and replace the checks from all generated javascript files.

Support

@IRCSS
IRCSS / SmoothGameCameraMovement.cs
Last active May 10, 2023 03:03
Unity Camera Movement in Game view like Scene View with filtering
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Moves Camera similar to how camera is moved in the Unity view port. Drop the scrip on the game object which has the camera and you wish to move.
public class SmoothGameCameraMovement : MonoBehaviour
{
public float lateralSpeed = 0.0015f;
using System.Collections;
using UnityEngine;
/// <summary>
/// GC friendly coroutine utilities
/// @JfranMora #UnityTips
/// </summary>
public static class CoroutineUtils
{
public static IEnumerator WaitForSeconds(float seconds)
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
public class HideSceneToolbar
{
[MenuItem("Test/Hide the scene toolbar")]
static void Hide()
{
var sceneViews = Resources.FindObjectsOfTypeAll<SceneView>();