Skip to content

Instantly share code, notes, and snippets.

Avatar

ohbashunsuke baobao

View GitHub Profile
View HelloWorldDOTween.cs
using System.Collections;
using UnityEngine;
using DG.Tweening;
public class HelloWorldDOTween : MonoBehaviour
{
void Start()
{
transform.DOLocalMove(new Vector3(10f, 0, 0), 1f);
}
@baobao
baobao / UIToolkit_DragAndDropTest.cs
Created Jan 6, 2021
【Unity】UI ToolkitのDragAndDropサンプル
View UIToolkit_DragAndDropTest.cs
using UnityEngine;
using UnityEngine.UIElements;
/// <summary>
/// DragAndDrop Sample
/// </summary>
[RequireComponent(typeof(UIDocument))]
public class UIToolkit_DragAndDropTest : MonoBehaviour
{
private Vector2 _dragOffset;
@baobao
baobao / UIToolkit_MouseDownUpTest.cs
Last active Jan 6, 2021
UI Toolkitサンプル:MouseDown・MouseUpショートコード
View UIToolkit_MouseDownUpTest.cs
using UnityEngine;
using UnityEngine.UIElements;
// 解説Qiita記事 : https://qiita.com/ohbashunsuke/items/ae1da96e582aef734eee
[RequireComponent(typeof(UIDocument))]
public class UIToolkit_MouseDownUpTest : MonoBehaviour
{
void OnEnable()
{
var document = GetComponent<UIDocument>();
View VFXGraphPlayEventSample.cs
// _visualEffect.SendEvent("OnPlay"); と同じ
// _visualEffect.SendEvent(VisualEffectAsset.PlayEventName); と同じ
_visualEffect.SendEvent(VisualEffectAsset.PlayEventID);
View GetVFXGraphId.cs
var id = Shader.PropertyToID("イベント名");
_visualEffect.SendEvent(id);
View VisualEffectAssetPart2.cs
/// <summary>
/// <para>The default name ID of the play event.</para>
/// </summary>
public static readonly int PlayEventID = Shader.PropertyToID("OnPlay");
/// <summary>
/// <para>The default name ID of the stop event.</para>
/// </summary>
public static readonly int StopEventID = Shader.PropertyToID("OnStop");
View VfxgraphPlayEvent.cs
// _visualEffect.SendEvent("OnPlay");と同じ
_visualEffect.SendEvent(VisualEffectAsset.PlayEventName);
View VisualEffectAssetPart.cs
/// <summary>
/// <para>The default name of the play event.</para>
/// </summary>
public const string PlayEventName = "OnPlay";
/// <summary>
/// <para>The default name of the stop event.</para>
/// </summary>
public const string StopEventName = "OnStop";
View create_article.sh
#!/bin/bash
# コピーしたいテンプレート記事パス
template='templates/article_template.md'
# 日付
date=`date '+%Y%m%d'`
# 検索対象フォルダ
dir='drafts/'
@baobao
baobao / UnityMicRecording.cs
Last active Sep 11, 2020
Unityで録音し、メモリ上に保持した録音サウンドを再生するサンプルコード
View UnityMicRecording.cs
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Unityで録音し、メモリ上に保持した録音サウンドを再生するサンプルコード
/// OnGUIでデバッグボタンを表示しています
/// </summary>
public class UnityMicRecording : MonoBehaviour
{
/// <summary>