-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Received "The method or operation is not implemented." on basic Select().Sum() in Unity #2
Comments
Thank you for detailed bug report and support! Your issue seems like the case that source generation is not happening. All the stub methods throws I have fixed several bugs with I also had some progress with Burst support, now it should work with Burst for simple operations that does not require ArrayPool. Will figure out how to support ArrayPool-based operations. |
Awesome, that is great news. I will be sure to give it a try here shortly. 👍 |
So, I gave this a go using the same example I tried last time. It looks like the code-gen was able to do it's thing: Generated Code// DO NOT EDIT
// Generated by LinqGen.Generator
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Cathei.LinqGen;
using Cathei.LinqGen.Hidden;
namespace Cathei.LinqGen.Hidden
{
// Non-exported Enumerable should consider anonymous type, thus it will be internal
internal struct Specialize_3 : IInternalStub<global::instance.id.ProStream.SerializedTerrain>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal Specialize_3(global::instance.id.ProStream.SerializedTerrain[] source_3) : this()
{
this.source_3 = source_3;
}
public int Count {[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => source_3.Length; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Select_2 Select(global::System.Func<global::instance.id.ProStream.SerializedTerrain, int> selector_2) => new Select_2(source_3, selector_2);
private global::instance.id.ProStream.SerializedTerrain[] source_3;
}
}
namespace Cathei.LinqGen
{
// Extension class needs to be internal to prevent ambiguous resolution
internal static partial class LinqGenExtensions_Specialize_3
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Specialize_3 Specialize(this global::instance.id.ProStream.SerializedTerrain[] source_3) => new Specialize_3(source_3);
}
} but for some reason I am getting the following: Error Message[CompilerError] 'SerializedTerrain[]' does not contain a definition for 'Specialize' and no accessible extension method 'Specialize' accepting a first argument of type 'SerializedTerrain[]' could be found (are you missing a using directive or an assembly reference?)
Compiler Error at /mnt/x/GitHub/instance-id/unity/projects/ProStream.package//instance.id/ProStream/instance.id.ProStream/Runtime/scripts/Features/Streaming/SceneOperations/TerrainSystem/Systems/PrepareHeightMapSystem/PrepareHeightMapSystem.cs:205 column 53
203: int materialCount = 0;
-->205: var matCount = terrainData.terrainArray.Specialize()
206: .Select(x => x.detailMaterials.Length)
207: .Sum(); I will try to look more into it after work. I have the assembly referenced properly and what not, closed the editor, etc. I might clear my library and let it redo everything just in case. Thanks, |
Huh, that's odd. The compile error should not happen even if generation failed, as stub method is still there. Again thanks for testing it out, it helps a lot for a preview project :) |
Sure thing, no worries. The error was from the Unity console. I am using 2022.2.0f1. I do use Pop_OS (Ubuntu) Linux, which shouldn't matter, that I am aware of, but figured I would share that info just in case. |
hi, I have the same error |
Hey there,
I wanted to test this out and get a feel for what it could bring to my project, but unfortunately, I received an error right off the bat.
I was attempting to use the following to count the number of materials I had stored in ScriptableObjects:
Both
terrainData.terrainArray
anddetailMaterials
are standard Array[] collections, which seemed like it should work fine based on what I saw in the Readme (with Select() and Sum() being supported), but have the following error:I am wondering if this has anything to do with how/where I am using it, as opposed to what I am using. I am using it in class derived from SystemBase (seen below), which already requires being partial due to source generation being ran on the Unity side of things, but I am using it in a method which is called by an event triggered by a state-machine I have made, so it is just a standard non-Burst compiled method.
The other thing that I am not sure which might be an issue is, all of my code is a package and contained within Assembly Definition files, and as such, in order to reference this package, I added this package as a local package and had to create an Assembly Definition file within your packages main folder. Then in my package, I had to add a reference to that newly created Assembly Definition in order to be able to gain access via
using Cathei.LinqGen;
Assembly Definition added to this package
Reference to this package Assembly Definition
I am not sure if this is causing any issue or not as I can properly access the stubs, my method is public, the class is public, etc. The above-mentioned items are the only things I can think of off-hand which are "out of the ordinary" for a Unity project.
P.S. I second the hope for Burst compatibility in the future. I suspect that most Unity users who come across this package are looking for performance anywhere they can find it, but also a slight reprieve from the additional boilerplate that DOTS can bring. So being able to simplify code with Linq-style code while maintaining the amazing performance Burst can bring is exactly the kind of thing I seek out. 👍
Thanks,
-MH
The text was updated successfully, but these errors were encountered: