Skip to content

Instantly share code, notes, and snippets.

@masa795
masa795 / ActiveScriptCompilationDefines.cs
Created Nov 2, 2013
ディレクティブ一覧を取得する
View ActiveScriptCompilationDefines.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class ActiveScriptCompilationDefines : EditorWindow {
[MenuItem ("Window/Active Script Compilation Defines")]
static void Init () {
@masa795
masa795 / FileIconTest2.cs
Created Oct 28, 2013
ボタンなどの画像サイズを変える
View FileIconTest2.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class FileIconTest2 : EditorWindow
{
Vector2 scrollPosition;
[MenuItem("Window/File Icon2")]
View GetIpAddress.cs
string targetSheet = "IP address取得";
if (GUILayout.Button(targetSheet, GUI.skin.button, GUILayout.Width(150), GUILayout.Height(30)))
{
// ホスト名を取得する
string hostname = Dns.GetHostName();
Debug.Log("hostname=" + hostname);
// ホスト名からIPアドレスを取得する
IPAddress[] adrList = Dns.GetHostAddresses(hostname);
foreach (IPAddress address in adrList)
@masa795
masa795 / IconTest_002.cs
Created Sep 1, 2013
EditorWindowに好きなアイコンを付ける
View IconTest_002.cs
using UnityEngine;
using UnityEditor;
public class IconTest_002 : EditorWindow {
[MenuItem("window icon/icon2")]
static void Init()
{
EditorWindow.GetWindow<IconTest_002>(false, "Firefox");
}
}
@masa795
masa795 / test.cc
Last active Dec 21, 2015
string -> float -> doubleチェック
View test.cc
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class test : MonoBehaviour {
public float m_float = 0f;
public double m_double = 0d;
public string m_input = "";
public string m_out = "";
@masa795
masa795 / AddStress.cs
Last active Dec 20, 2015
UnityでCPU負荷をかける
View AddStress.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Threading;
public class AddStress : MonoBehaviour
{
#region 設定
@masa795
masa795 / InitOnLoad.cs
Created Jul 27, 2013
シーンをメニューから開く。メニューに表示するシーンは自動で作成される。 https://github.com/masa795/OpenSceneFromMenuCreator
View InitOnLoad.cs
using UnityEngine;
using UnityEditor;
namespace Nlib.Editor.Util
{
[InitializeOnLoad]
public class InitOnLoad
{
@masa795
masa795 / TrustAllCertificatePolicy.cs
Created Jul 7, 2013
CertificatePolicy を更新する
View TrustAllCertificatePolicy.cs
public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
{
public TrustAllCertificatePolicy() { }
public bool CheckValidationResult(System.Net.ServicePoint sp,
System.Security.Cryptography.X509Certificates.X509Certificate cert,
System.Net.WebRequest req,
int problem)
{
return true;
@masa795
masa795 / UnityTextures.cs
Created Jun 17, 2013
Unityが持っているアイコンを表示する。 Unityのバージョンによってはパスが使えなくなるかもしれないので使用時は注意。
View UnityTextures.cs
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
//Unity 4.1.5
public class UnityTextures : EditorWindow
{
@masa795
masa795 / EditorApplication.ExecuteMenuItem.cs
Last active Dec 17, 2015
EditorApplication.ExecuteMenuItemサンプル
View EditorApplication.ExecuteMenuItem.cs
if (GUILayout.Button(new GUIContent("test"), GUILayout.Height(20)))
{
string menue = "Window/Asset Store";
menue = "NGUI/Panel Tool";
EditorApplication.ExecuteMenuItem(menue);
}