Closed Neraull closed 1 year ago
Hi @Neraull, this is a null-coalescing operator with the inline property. I use a newer C# compiler I suppose that must be the issue. Will make sure I am writing older and more common version. You can replace this line with
private Configuration Configuration
{
get
{
if (configuration == null)
{
configuration = new Configuration();
}
return configuration;
}
}
Hi Srcnalt, thanks for the quick response!
i replaced the line with the block of code above, and there are cascading errors that pop up in other classes. lol
it first showed me that it couldn't make line 5 in IRsponse a public: public ApiError Error { get; set; }
then after fixing that, it now tells me: Assets\Samples\OpenAI Unity\0.1.2\DallE\DallE.cs(35,23): error CS1003: Syntax error, '(' expected
I'm assuming it's an issue on my end with an older compiler?
Thanks for the help.
attaching images of what i'm seeing.
So seems like the issues are:
var request = new RequestType(){ params... }
with ()
paranthesis should be used.I suppose I should reduce my C# version and have another pass on the whole code.
ahh ok. so it's more different compiler versions causing these issues. Should i just wait for your next version then?
Updated the code to be C# 6 compatible and made a release #8 v0.1.3 should be working fine. Could you update the package in Unity Package Manager and let me know if all works fine?
Heya,
I reimported the package again and it seems fine until i import the DallE sample.
then the following error pops up:
Sorry forgot this one, you can wrap the content of the if block in there in a using block.
using(var request = new UnityWebRequest(response.Data[0].Url))
{
request.downloadHandler = new DownloadHandlerBuffer();
request.SendWebRequest();
while (!request.isDone) await Task.Yield();
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(request.downloadHandler.data);
var sprite = Sprite.Create(texture, new Rect(0, 0, 256, 256), Vector2.zero, 1f);
image.sprite = sprite;
}
awesome! completely works now for testing and base functions. Thank you so much, you're awesome for doing this.
hi, i've just imported the package into unity (2019.4.38f1c1 LTS) on windows and it immediately gives me the following error:
Library\PackageCache\com.srcnalt.openai-unity@f06833f4ff\Runtime\OpenAIApi.cs(19,64): error CS1525: Invalid expression term '='
it seems to refer to the line: private Configuration Configuration => configuration ??= new Configuration();
Would you happen to know what the problem could be?
Thanks!