I want to use AdminApiClient in CloudCode (config.Dependencies.AddSingleton(AdminApiClient.Create());
)
But i realized its only avaliable in Unity.Services.CloudCode.Core.Admin
which is not avaliable in CloudCode.Core (0.0.1).
So i updated it with NuGet to version (Com.Unity.Services.CloudCode.Core to 0.0.2
). The code compiles and works properly when deployed but when generating bindings with updated module im having following error and no code is being generated (only assembly definition file is generated).
The error is not printed in console nor in deployment window, only in .ccmr file in inspector.
I need to access admin data & methods for matchmaking which im unable to do so (with generated bindings)
BTW i filed bug report IN-85351
1 Like
I also would like to point out another uncomfortable fact that:
- When generating bindings no overloaded constructors are being transferred to generated code which makes it cumbersome to use transferred data structures - workaround is to write partial class that has overloaded constructors
Hi, we’re aware of this issue and have an SDK update coming soon to fix it. Apologies for the inconvenience.
Regarding the constructors, I can’t promise anything right now but I’ll bring it up with the team. Thanks for the feedback.
Thank you for fast reply, i would also like to add that it would be super helpful for bindings:
- to be generated as static class/methods
- transferring class & method comments (<summary></summary> etc.)
- transferring methods from classes
- properly serializing Enums and Tuples
These are inconvinient bits i encountered when working on it, i believe it will be improved & developed in future, appreciate the work anyway <3
Hey!
Will bring feedback to the team.
- to be generated as static class/methods
This is not likely to happen, as static methods/classes are much harder to test, and it would add an additional branching path to the generation. Instances are the way to go for this kind of stuff. (specially if you need to mock them in your code.
- transferring class & method comments
This info is a bit harder to acquire, but I know we wanted to look at it ineventually.
- transferring methods from classes
Technical feasibility is very limited. Unity is running C#8, whereas you can run up to C#13 on CloudCode. This doesnt even take into account the .NET version you are running, or the dependencies you might be running on the CloudCode side. However, if you are intent on doing this, you can do this easily manually by keeping your DTOs in Unity and sharing them with the C# side using a Compile
item group on the CloudCode side:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="../Assets/DTOs/**/*.cs" />
</ItemGroup>
</Project>
- properly serializing Enums and Tuples
Enums should be fixed in the next iteration, though we have to look at tuples.
Hope this helps!
Cheers