Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

unity fails to compile valid c# expression

Discussion in 'WebGL' 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 ;)