Skip to content

Instantly share code, notes, and snippets.

@tklee1975
tklee1975 / main.dart
Created September 19, 2020 08:40
A very simple flutter widget!
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Shader "Kencoder/skin_shader"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB), Thickness (A)", 2D) = "white" {}
//_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Metallic ("Metal (R), Smoothness (A)", 2D) = "white" {}
_BumpMap ("Normal (Normal)", 2D) = "bump" {}
_Scale ("Thickness Scale", Range(0,1)) = 0.0
@tklee1975
tklee1975 / RawImageAspectFitter.cs
Created December 11, 2019 15:17
Automatically Aspect Fit the RawImage (One of the Unity UI Component)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RawImageAspectFitter : MonoBehaviour
{
[SerializeField] bool m_adjustOnStart = true;
protected RawImage m_image;
@tklee1975
tklee1975 / ParticleAnalyzer.cs
Created October 18, 2019 16:22
A simple unity script used to breakdown the Particle VFX so that users can check each particle VFX one by one.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParticleAnalyzer : MonoBehaviour
{
[SerializeField] protected ParticleSystem particle;
protected ParticleSystemRenderer[] allParticles;
// Start is called before the first frame update
@tklee1975
tklee1975 / gist:8711f8ca8b5e1483d52dab6e486d919a
Created May 14, 2019 17:30
Unity UI Selectable Navigation Code
public Button[] buttonArray;
public Selectable currentSelectable;
public void nextButton() {
if(currentSelectable == null) {
currentSelectable = buttonArray[0];
currentSelectable.Select();
return;
}
currentSelectable = currentSelectable.FindSelectableOnDown();
@tklee1975
tklee1975 / BlurShader.shader
Created April 27, 2019 06:52
Simple Unity 2D Shader
Shader "Unlit/BlurShader"
{
Properties
{
[PerRendererData] _MainTex ("Texture", 2D) = "white" {}
_BlurSize ("Blur Size", Float) = 1.0
}
SubShader
{
Tags {"Queue"="Transparent" "RenderType"="Transparent" }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(RawImage))]
[ExecuteInEditMode]
public class AspectFitRawImage : MonoBehaviour
{
protected RawImage m_rawImage;
@tklee1975
tklee1975 / TextStyle.cs
Created April 15, 2019 19:02
Unity UI Tip - Text Style Setting
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[ExecuteInEditMode]
[RequireComponent(typeof(Text))]
public class TextStyle : MonoBehaviour
{
[SerializeField] protected TextStyleSetting.Style m_style;
@tklee1975
tklee1975 / HeroInfoView1.cs
Created April 4, 2019 19:13
Demo Unity Source for "Unity UI Tips" #2
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HeroInfoView1 : MonoBehaviour
{
public Image heroImage;
public Text nameText;
public Text hpText;
@tklee1975
tklee1975 / TestTableViewCell.cs
Created April 2, 2019 07:58
Sample Code for TSTable (Simple Scenario)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Tacticsoft;
public class TestTableViewCell : TableViewCell
{
[SerializeField] public Text m_rowText;