以下の内容はhttps://baba-s.hatenablog.com/entry/2018/05/26/131100より取得しました。


【Unity】UnityEvent で RemoveAllListeners してから AddListener する拡張メソッド

ソースコード

using System;
using UnityEngine.Events;

public static class UnityEventExt
{
    public static void SetListener( this UnityEvent self, Action call )
    {
        self.RemoveAllListeners();
        self.AddListener( () => call() );
    }

    public static void SetListener( this UnityEvent self, UnityAction call )
    {
        self.RemoveAllListeners();
        self.AddListener( call );
    }
}

使い方

button.onClick.SetListener( () => {} );



以上の内容はhttps://baba-s.hatenablog.com/entry/2018/05/26/131100より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14