Answers for "start a void from string unity"

C#
1

start a void from string unity

using UnityEngine;
using System.Collections.Generic;

public class ExampleScript : MonoBehaviour
{
    // Launches a projectile in 2 seconds

    Rigidbody projectile;
    string voidName = "LaunchProjectile";

    void Start()
    {
        Invoke(voidName, 2.0f);
    }

    void LaunchProjectile()
    {
        Rigidbody instance = Instantiate(projectile);
        instance.velocity = Random.insideUnitSphere * 5.0f;
    }
}
Posted by: Guest on February-26-2021

Code answers related to "start a void from string unity"

C# Answers by Framework

Browse Popular Code Answers by Language