Search Unity

unity fails to compile valid c# expression

Discussion in 'Web' started by mnml_, Oct 14, 2015.

  1. mnml_

    mnml_

    Joined:
    Jun 17, 2015
    Posts:
    44
    this statement fails to compile with the current beta:
    Code (CSharp):
    1. var foo = Enumerable.Range(0, Input.touchCount).Select(Input.GetTouch);
    error CS0411: The type arguments for method `System.Linq.Enumerable.Select<TSource,TResult>(this System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,int,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly

    whereas this works:
    Code (CSharp):
    1. var foo = Enumerable.Range(0, Input.touchCount).Select(p => Input.GetTouch(p));
    both should be valid afaik
     
  2. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Only in WebGL?
     
  3. mnml_

    mnml_

    Joined:
    Jun 17, 2015
    Posts:
    44
    good question, didn't try to switch platform yet, will let ya know as soon as i find some time ;)