Make Extensions return a value

Yeah, so i’m trying to make an Extension for myself.
But i can’t figure out a way to actually make my extension return a value.
here is what i have so far:

public static class Extension_Damage 
{
	public static void doDamage( this Transform target, float damage )
	{
         //return damage * 2;
	}
}

i tried IENumerator, removing the static and some more. Please help me

Hi

you have to specify the return type of the function. Its currently void - change it

public static class Extension_Damage
{
   public static float doDamage( this Transform target, float damage )
   {
      return damage * 2.0f;
   }
}

syntax is like:

<visibility> <return type> <name>(<parameters>)
{
<function code>
}

However you should think about your function :slight_smile: it makes no use of the first parameter. But I think you are going to extend this :wink:

hope it helps