Skip to content

Instantly share code, notes, and snippets.

@JoseMiguelPizarro
JoseMiguelPizarro / KeywordEnum.shader
Last active September 11, 2024 08:38
Example of how to use the KeywordEnum shader attribute
Shader "Unlit/KeywordEnum"
{
Properties
{
[KeywordEnum(Red,Green,Blue)] _Color("Color",int) = 0
}
SubShader
{
Pass
{
@JoseMiguelPizarro
JoseMiguelPizarro / ProceduralMesh.shader
Last active August 3, 2021 00:41
Procedural Stripe using Compute shaders for Unity
Shader "Custom/ProceduralMesh"
{
subshader
{
pass
{
HLSLPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert
@JoseMiguelPizarro
JoseMiguelPizarro / PreviewData.cs
Created April 6, 2021 15:17
Rendering preview window in Unity
using UnityEngine;
[CreateAssetMenu(menuName ="Data/PreviewData")]
public class PreviewData : ScriptableObject
{
public Color previewColor;
}
using System;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
public class RaycastCommandRaycaster: IDisposable
{
NativeArray<RaycastCommand> commands;
NativeArray<RaycastHit> results;
@JoseMiguelPizarro
JoseMiguelPizarro / DropdownList.cs
Created December 28, 2019 12:03
DropdownList with Enums using UIElements
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor;
using System;
using System.Reflection;
public class DropdownList : BaseField<Enum>
{
import bpy
def paintVerteces():
ob = bpy.context.object
print(ob.name)
bpy.ops.object.mode_set(mode='VERTEX_PAINT')
maxZ = float('-inf')
minZ = float('inf')
@JoseMiguelPizarro
JoseMiguelPizarro / LICENSE
Created November 9, 2019 12:27 — forked from JohannesMP/LICENSE
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*
private void OnSceneGUI()
{
DrawToolBar(SceneView.lastActiveSceneView);
activeTool.Act(this, Event.current);
}
private GUIContent[] toolsButton;
private List<LevelMeshTool> tools;
private LevelMeshTool activeTool;
int m_selectedTool;
int selectedTool
{
get => m_selectedTool;
set
{
m_selectedTool = value;
using System.Collections.Generic;
using System;
public static class LevelMeshToolProvider
{
public static List<LevelMeshTool> tools = new List<LevelMeshTool>();
static LevelMeshToolProvider()
{
foreach (var type in GetAllTypes(AppDomain.CurrentDomain))