Skip to content

Instantly share code, notes, and snippets.

View klkucan's full-sized avatar
🎯
Focusing

P.P.K Wanna Be klkucan

🎯
Focusing
View GitHub Profile
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
@klkucan
klkucan / FBXMeshExtractor.cs
Last active May 2, 2024 06:23
Extracting Meshes from FBX Files
using UnityEngine;
using UnityEditor;
public class FBXMeshExtractor
{
private static string _progressTitle = "Extracting Meshes";
private static string _sourceExtension = ".FBX";
private static string _targetExtension = ".asset";
@klkucan
klkucan / Use csv file in Unity.cs
Last active September 12, 2017 13:01
Use csv file in Unity
public class Story
{
public int INDEX;
/// <summary>
/// 剧情阶段
/// </summary>
public int Step;
/// <summary>
/// 剧情类型(int)
/// 0:动画,1:声音(说话等),2:移动,3:展示与隐藏(用于剧情人物出现在不同的地方),
@klkucan
klkucan / ButflyCOM.cs
Last active September 12, 2017 13:00
Unity use ComPort
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Text;
using System.Threading;
namespace ButflyCOM
{
public class ButflyCOMPort
{
@klkucan
klkucan / csv.lua
Created September 20, 2017 06:37 — forked from cuixin/csv.lua
Using lua to parse CSV file to a table.
-- Using lua to parse CSV file to a table.
-- Notice: first line must be data description filed.
-- The separator is '|', change it if you want.
-- Usage: csv = require('csv')
-- tab = csv.load('test.csv', ',')
-- table.foreach(tab[1], print)
-- print(tab[1].you_field)
--encoding=utf-8
@klkucan
klkucan / UniqueString.cs
Last active October 2, 2020 14:40
this is a variant of string, it can be clear form memory.
using System.Collections;
using System.Collections.Generic;
public class UniqueString
{
// 'removable = false' means the string would be added to the global string pool
// which would stay in memory in the rest of the whole execution period.
public static string Intern(string str, bool removable = true)
{
if (str == null)
@klkucan
klkucan / ClearConsole.cs
Last active October 17, 2017 02:26
UnityClearConsole in edtior
[MenuItem("Tools/ClearConsole")]
private static void ClearConsole()
{
#if UNITY_5
var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll");
var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
clearMethod.Invoke(null,null);
#elif UNITY_2017
var assembly = Assembly.GetAssembly(typeof(SceneView));
var type = assembly.GetType("UnityEditor.LogEntries");
@klkucan
klkucan / steamvr.vrsettings
Created October 23, 2017 02:25
delete collisionBounds in steamvr
"collisionBounds" : {
"CollisionBoundsColorGammaA" : 0,
"CollisionBoundsColorGammaR" : 255
},

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
@klkucan
klkucan / Download.cs
Last active November 14, 2017 17:28
Unity从PHP服务器下载文件
IEnumerator GetFile()
{
string path = "D:\\Resource4Code\\php\\file\\";
Debug.Log(path);
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
UnityWebRequest www = new UnityWebRequest("127.0.0.1/filedownload.php");
www.downloadHandler = new DownloadHandlerBuffer();