Is it possible to use Unity Classes (Vector3) in an external c# console application?

Hey everybody,

I am trying to understand if it is possible to use the Unity Classes (such as Vector3, Quaternion, Transform) in a simple C# based console application external to Unity.
My current setup is in visual studio I created a .NET Core Console App (Not sure if this is the issue due to .Net Core compatibility) then I added the UnityEngine.dll as a reference.

I wrote this simple Program.cs to test if I could access the variables and while I was writing it the autocomplete and function recognition all works correctly leading me to believe the reference was added correctly.

using System;
using UnityEngine;

namespace ConsoleUnityTest
    class Program
        static void Main(string[] args)

            Vector3 test = new Vector3(0, 0, 0);

When trying to run this program it compiles correctly but gets this error in Visual Studio:
System.IO.FileNotFoundException: ‘Could not load file or assembly ‘UnityEngine, Version=, Culture=neutral, PublicKeyToken=null’. The system cannot find the file specified.’

Any help around how I could make this setup work or suggestion of an alternative other solution would be much appreciated.

Thanks, Callum

This can be simply answered with NO for several reasons: First and foremost you are not allowed to use any part of the Unity engine outside a Unity project. Second, even if some parts of types defined in the UnityEngine.dll would work, other parts are just managed wrappers which refer to native code. So even most of the Vector3 or the Quaternion struct are written in managed code, there are several methods which are declared external and are defined in the native C++ code.

Most actual classes and component like the Transform component are purely wrapper classes. The whole functionality is defined in the C++ core and pretty much every method and property is actually declared external.

Final note: Please make sure when viewing the repository i’ve linked above, that this has a special license applied. The repository is there only for reference. You are not allowed to copy or use any of the provided source code in your projects.