Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[Open Source] inFluent - A Fluent API extension

Discussion in 'Assets and Asset Store' started by garrido86, Aug 14, 2016.

  1. garrido86


    Dec 17, 2013
    Hey guys, I recently had developed a desire of a fluent API for GameObjects where you can simply chain methods with ease. Sadly there where as far I am concerned none, so I went there and started inFluent as a side project.

    The readme on the GitHub page explains pretty much everything but let me show you one example which is my personal favorite: Attaching Components while changing it's properties and invoking methods with a simple lambda!

    Code (CSharp):
    1.     this.gameObject.AttachComponent<AudioSouce>((r, c) =>
    2.                     {
    3.                         if(r)
    4.                         {
    5.                             c.clip = AmbientMusic;
    6.                             c.loop = true;
    7.                             c.volumen = StartAudioSound;
    8.                             c.Play();
    9.                         }
    10.                     });
    What do you guys think?