Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AWS: Need to add reference to assembly SWSSDK.core

Discussion in 'Scripting' started by DcoltGaming, Apr 17, 2020.

  1. DcoltGaming

    DcoltGaming

    Joined:
    Feb 11, 2014
    Posts:
    3
    Hi all,

    I am trying to build a Amazon polly implementation using the following code:

    Code (CSharp):
    1. using UnityEngine;
    2. using System;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. using Amazon;
    7. using Amazon.Runtime;
    8. using Amazon.CognitoIdentity;
    9. using Amazon.CognitoSync.SyncManager;
    10. using Amazon.Polly;
    11. using Amazon.Polly.Model;
    12. using System.IO;
    13.  
    14.  
    15. namespace AWSSDK.Examples
    16. {
    17.  
    18.     public class CognitoSyncManagerSample : MonoBehaviour
    19.     {
    20.         public AWSCredentials _credentials;
    21.  
    22.         // Initialize the Amazon Cognito credentials provider
    23.         CognitoAWSCredentials credentials = new CognitoAWSCredentials("//poolID", RegionEndpoint.EUWest2);
    24.  
    25.         void Start()
    26.         {
    27.  
    28.             AmazonPollyClient pc = new AmazonPollyClient(_credentials, RegionEndpoint.EUWest2);
    29.             SynthesizeSpeechRequest sreq = new SynthesizeSpeechRequest();
    30.  
    31.             sreq.Text = "Hello my name is Dan";
    32.             sreq.OutputFormat = OutputFormat.Mp3;
    33.             sreq.VoiceId = VoiceId.Amy;
    34.             SynthesizeSpeechResponse sres = pc.SynthesizeSpeech(sreq);
    35.  
    36.             using (var fileStream = File.Create(@"C:\yourfile.mp3"))
    37.             {
    38.                 sres.AudioStream.CopyTo(fileStream);
    39.                 fileStream.Flush();
    40.                 fileStream.Close();
    41.             }
    42.  
    43.         }
    44.  
    45.     }
    46. }
    47.  
    I have a linker file in the Resources folder which is

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2.  
    3. <linker>
    4.   <assembly fullname ="Amazon">
    5.     <type fullname="AWSSDK.Core" preserve="all"/>
    6.   </assembly>
    7.   <assembly fullname ="Polly">
    8.     <type fullname="AWSSDK.Polly" preserve="all"/>
    9.   </assembly>
    10.   <assembly fullname ="Security">
    11.     <type fullname="AWSSDK.SecurityToken" preserve="all"/>
    12.   </assembly>
    13.   <assembly fullname ="CognitoIdentity">
    14.     <type fullname="AWSSDK.CognitoIdentity" preserve="all"/>
    15.   </assembly>
    16. </linker>
    17.  
    I have AWSSDK.CognitoIdentity.dll under Assets/AWSSDK and under Plugins I have AWSSDK.Core.dll and AWSSDK.Polly.dll

    All of my code is fine, apart from the line:
    CognitoAWSCredentials credentials = new CognitoAWSCredentials("//poolID", RegionEndpoint.EUWest2);
    which is throwing up a error saying 'Error CS0012 The type 'RegionEndpoint' is defined in an assembly that is not referenced. You must add a reference to assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=null'.' - However my linker file has a reference to AWSSDK.core so I am confused as to what is going wrong
     
  2. SkarFace86

    SkarFace86

    Joined:
    May 6, 2017
    Posts:
    2
    Were you able to find a solution to this?
     
  3. Jan-Vrabel

    Jan-Vrabel

    Joined:
    Oct 24, 2015
    Posts:
    5
    Facing this same issue, not solution found yet