Im following a shading tutorial GPU Path Tracing in Unity – Part 3 – Three Eyed Games
and it uses something like this
var indices = mesh.GetIndices(0);
_indices.AddRange(indices.Select(index => index + firstVertex));
And unity has a problem at “indices.Select()” Because int.Select “does not exist”
How do i make that not happen?
Select is a standard extension method that comes with the Linq extension. You have to add
using System.Linq; to the top of your script in order to use them. This looks like an oversight to me that they didn’t include it in the code snippets. Though on the other hand when it comes to plain C# certain things has to be assumed as basic knowledge. So you can not always start at the very bottom.
The Select method return a new collection (IEnumerable) which applies the provided selection callback to each element. So the new collection will go through all the indices and add “firstVertex” as an offset to the index.