I used the package manager to install "Alpaca.Markets" API package with no error messages. The script is simple: using Alpaca.Markets; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Trade02 : MonoBehaviour { private static AlpacaTradingClient client; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } } When I run Unity I get the error message: error CS0246: The type or name 'Alpaca' could not be found (The Alpaca.Markets API package works in c# program. I am trying to create interface with Unity) Any suggestions would be helpful. Thanks
Can you post the version of Unity you were running and attach any editor logs you have? It would also help if you could include your project's manifest.json.
Thanks for replying. I am using Unity 2018.4.10f1 I am new to using Unity - where do I find the manifest.json Where do I find the editor log. Since I am trying to use the Alpaca API, I only created a GameObject (cube) and attached the script to it. In Visual Studio I installed the Alpaca.Markets package using the package manager.
You can find your project's manifest.json in [Your project folder]/Packages - replace [Your project folder] with the path to your project. This page will let you know where you can find the log files: https://docs.unity3d.com/Manual/LogFiles.html
It seems as though the Alpaca.Markets API package may not have installed for your project at all, I can't see it in the manifest.json; as far as I know, packages installed for your project should have a corresponding listing in the manifest. Does the Alpaca.Markets package show up in the 'In Project' tab of Package Manager for you? I'm also curious as to where you installed the package from. Did you install it from disk through Package Manager?
If I go to the project manager and select the installed tab I get the following: so it looks like it is installed. I didn't install it from a disk. I clicked on: Project --> Manage NuGet Packages.. --> Browse --> (Entered) Alpaca.Markets not sure where it looks for the NuGet packages I didn't see an 'In Project' tab.
Ah, sorry, I didn't realize you were referring to NuGet package manager in Visual Studio - in that case, there are some extra steps you would need to take to get your script running in Unity. You can try referring to this article to see if it helps with your problem: https://docs.microsoft.com/en-us/visualstudio/cross-platform/unity-scripting-upgrade?view=vs-2019 There's a section specifically called 'Add packages from NuGet to a Unity project' which may help.
I made the changes described in the link. I don't get any error messages for the script in Visual Studio. I am getting the following error messages in Unity: Assembly 'Library/ScriptAssemblies/Assembly-CSharp.dll' will not be loaded due to errors: Reference has errors 'Alpaca.Markets'. Assembly 'Assets/Plugins/Alpaca.Markets.dll' will not be loaded due to errors: Unable to resolve reference 'Newtonsoft.Json'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector. Unable to resolve reference 'Microsoft.Extensions.Configuration.Abstractions'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector. Unable to resolve reference 'WebSocket4Net'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector. Unable to resolve reference 'SuperSocket.ClientEngine'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector. Can you tell me how to fix this. Thanks
It looks you need to repeat what you did for the Alpaca.Markets package for the NuGet packages it depends on as well. NuGet package manager will tell you which packages those are in the 'Dependencies' section for Alpaca.Markets. Try repeating the process for each of those packages and see if it works.