1. Last edited by a moderator: May 29, 2016
  2. Type not correct?

    using System.Collections; <> using System.Collections.Generic;
     
  3. How use Corountine in Plugin Unity ?
     
  4. Code:
    using UnityEngine;
    using System.Collections.Generic;namespace Oxide.Plugins
    {
        [Info("MyPlugin", "xxx", "0.0.1")]
        [Description("This Plugin displays...")]
        class MyPlugin : RustPlugin
        {
            public class SubClass : MonoBehaviour   //<<< Works ONLY with MonoBehaviour as Nested-Class
            {
                IEnumerator Start()
                {
                    StartCoroutine("DoSomething", 2.0F);
                    yield return new WaitForSeconds(1);
                    StopCoroutine("DoSomething");
                }
              
                IEnumerator DoSomething(float someParameter)
                {
                    while (true)
                    {
                        print("DoSomething Loop");
                        yield return null;
                    }
                }
            }
        }
    }
     
  5. Wulf

    Wulf Community Admin

    Why do you need to use coroutines? If you want to add a delay to something, use Oxide's timer library.