cvona

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • June 19, 2025 at 10:32 am #1783

    Thank you for the information!

    June 16, 2025 at 7:17 am #1739

    Thank you, Robert. Please let me know if you manage.

    June 13, 2025 at 2:21 pm #1734

    This looks exactly like what we want. When do you think it could be ready, approximately? We start the pilot on the 1st of July.

    June 13, 2025 at 9:47 am #1731

    Hi Bob, I do not know if you saw my previous message. The problem of the WebRequestNode, is that inside is hardcoded headers[“Authorization”] = token.StartsWith( “Bearer ” ) ? token : “Bearer ” + token; while my header starts with “Basic”. I am trying to modify it, but I get this error when I add the script to the project:  [CS0012] WebRequestNode.cs(351,45): The type ‘WWWForm’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘UnityEngine.UnityWebRequestModule, Version=0.0.0.0,

    June 13, 2025 at 9:21 am #1728

    I had a look at the WebRequest node script. It does not work because the node is not good for making an authentication.

    I decided to modify it to work the way I want. What I should do is the following:

    static async Task<string> Autentication()
    {
    string ret = “”;
    string credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($”{StringUtils.CLIENT_ID}:{StringUtils.CLIENT_SECRET}”));
    string postData = “grant_type=client_credentials”;
    Console.WriteLine($”credentials: {credentials}”);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(StringUtils.ACCESS_TOKEN_URL);
    request.Method = “POST”;
    request.ContentType = “application/x-www-form-urlencoded”;
    request.Headers[“Authorization”] = $”Basic {credentials}”;

    using (var stream = new StreamWriter(request.GetRequestStream()))
    {
    stream.Write(postData);
    }
    try
    {
    using (var response = (HttpWebResponse)request.GetResponse())
    using (var reader = new StreamReader(response.GetResponseStream()))
    {
    string result = reader.ReadToEnd();
    Console.WriteLine(“Token Response: ” + result);

    // Estrai il token (usa un parser JSON se vuoi farlo in modo robusto)
    var tokenStart = result.IndexOf(“access_token\”:\””) + 15;
    var tokenEnd = result.IndexOf(“\””, tokenStart);
    ret = result.Substring(tokenStart, tokenEnd – tokenStart);
    }

    }
    catch (WebException ex)
    {
    using var errorResponse = (HttpWebResponse)ex.Response;
    using var reader = new StreamReader(errorResponse.GetResponseStream());
    string errorText = await reader.ReadToEndAsync();
    Console.WriteLine(“Errore server: ” + errorText);
    ret = “0”;
    }
    return ret;

    }

     

    By trying to modify the node, I also get some errors. The main one is [CS0012] WebRequestNode.cs(351,45): The type
    ‘WWWForm’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘UnityEngine.UnityWebRequestModule, Version=0.0.0.0,
    Culture=neutral, PublicKeyToken=null’, which, as you can see here, I also have it when uploading the WebRequestNode from the directory with all the examples. I tried to include “using UnityEngine.Networks;” but it does not solve the problem.

     

    June 12, 2025 at 4:44 pm #1726

    In my test, I did not include everything, since I wanted to test if it was working well or not. I was expecting an error message as output value, but this did not work. Should it work in your opinion? Why does async not work? It was very difficult to find the reason since F12 doesn’t work in the PH, and the files did not give errors during the upload.

    I am not sure I can send you everything since the request is for authenticating on the server, maybe the best is if you send me an example working that I can try to replicate.

    Thank you for your help.

    May 27, 2025 at 1:54 pm #1623

    I made a small project as example but I do not find how to upload it here

    May 20, 2025 at 3:23 pm #1581

    Hi Jason,

    After removing some of the assets, the problem disappeared, and then it happened again. It looks to me that the problem started again after I uploaded a video. By looking better, it looks like the avatar starts to fly. I cannot reproduce it because it is random, but I got it several times. It looks like it is triggered by some assets, but I do not get what they have in common.

    May 20, 2025 at 8:12 am #1565

    avatar_big

    May 14, 2025 at 2:47 pm #1546

    Thank you!

     

    May 13, 2025 at 3:57 pm #1542

    Thank you Robert for the answer. What we have is a quiz on a screen, the answers are written inside 3 buttons that we created. It looks weird to go so close and touch them. The Raycast would be better. I will try to think to an other option.

    May 8, 2025 at 7:28 am #1524

    Thank you, I will!

     

    May 6, 2025 at 8:17 am #1511

    This is the name: Greenhouse: IoT Lesson

    • This reply was modified 1 month, 2 weeks ago by cvona.
    April 1, 2025 at 7:26 pm #1422

    Unfortunately, what you suggested is what I tried at the beginning, but the result, for some reason, is 2. To get 1, I have to do the following:

    If I do this the first time it is fine, but for action that occurs later on, this resets the score to 0, so the result is always 1. In the case I do here as you suggested, I get 3 instead of 2. Why is this happening?

    March 31, 2025 at 3:04 pm #1414

    I was able to create the signal variable, but how can I store on it the new values as the score increases? I am not using loops for the moment.

Viewing 15 posts - 1 through 15 (of 18 total)