Skip to content

Instantly share code, notes, and snippets.

@onionmk2
onionmk2 / Trail.cs
Created July 17, 2017 02:20
change individual particles's velocity via script
using UnityEngine;
public class Trail : MonoBehaviour {
ParticleSystem system;
public Transform anchor;
private Vector3 anchorPosition;
private void Awake()
{
system = GetComponent<ParticleSystem>();
public class Hi : Conditional
{
public override void OnTriggerEnter(Collider other)
{
Debug.Log("enter");
}
public override TaskStatus OnUpdate()
{
return TaskStatus.Running;
@onionmk2
onionmk2 / AnimationAction.cs
Last active July 3, 2017 16:35
Behavior Designer Animation Action sample.
using System.Collections;
using System.Linq;
using System.Reflection;
using BehaviorDesigner.Runtime.Tasks;
using UnityEngine;
internal class DamageAction : Action
{
private Animator animator;
private bool isCoroutineRunning;
@onionmk2
onionmk2 / AsyncAction.cs
Created July 3, 2017 15:21
Async Action in Behaviour Designer
using System.Collections;
using BehaviorDesigner.Runtime.Tasks;
using UnityEngine;
internal class AsyncAction : Action
{
private bool isCoroutineRunning;
public override void OnStart()
{
@onionmk2
onionmk2 / AnimationClipLoaderEditor.cs
Created June 27, 2017 08:34
force Update Animator to have Animation Clips at Resources folder.
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
namespace OnionMk2
{
/// <summary>
/// Load AnimationClip from Resources folder and
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
namespace AnimatorLikeAnimation.Style5
{
@onionmk2
onionmk2 / UsingJsonDotNetInUnity.cs
Last active August 17, 2022 20:08
Json.Net ( Newtonsoft.Json ) in Unity
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using UnityEngine;
public class UsingJsonDotNetInUnity : MonoBehaviour
{
private void Awake()
{
@onionmk2
onionmk2 / CoLearn.cs
Created June 11, 2017 08:05
コルーチンの基礎を学ぶ
using System.Collections;
using UnityEngine;
public class CoLearn : MonoBehaviour
{
private IEnumerator Log()
{
print("Time.frameCount" + Time.frameCount);
yield return null; // 中断して次のフレームで再開
@onionmk2
onionmk2 / VR MAGICの動画メモ.md
Last active July 11, 2018 05:37
【Unite 2017 Tokyo】VR MAGIC! ~キャラクターに命を吹き込んだこの4年間の記録~ https://www.youtube.com/watch?v=nWR816af2dU の動画でさらに理解がすすんだところ

イキイキしたキャラクター表現

プレゼンス

ハイライト

  • PS2くらいまではリソース不足のため、テクスチャにハイライトを書き込んでいた
  • ライトの色を変えたら、目のハイライトまでそのまま変わってしまい、イキイキ感が減る
var animator = GetComponent<Animator>();
var layer = animator.GetLayerIndex("Face");
// 戻り値がコレクションなのと、型がAnimatorClipInfoである(AnimationClipInfoではない)のに注意
AnimatorClipInfo[] clips = animator.GetCurrentAnimatorClipInfo(layer);
foreach (var c in clips)
{
print(c.clip.name + " : weight " + c.weight);
}