Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# delegate

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DelegateTest : MonoBehaviour
{
    public delegate void TestDelegate();

    private TestDelegate testDelegate;

    
    // Start is called before the first frame update
    void Start()
    {
        testDelegate = MyDelegateFunc;

        testDelegate();
    }

    // Update is called once per frame
    void Update()
    {
        
    }


    private void MyDelegateFunc()
    {
        Debug.Log("My DelegateFunc");
    }
}
Source by learningneverendstech.com #
 
PREVIOUS NEXT
Tagged: #delegate
ADD COMMENT
Topic
Name
6+5 =