Changing Variables via External Application, or Memory Mapping .NET 3.5

**Goal:**When I change the value of some int x in the VS application. The Unity application displays the new value for x.

Question:
1) Is it possible?
2) How do I do it?

What I have:
I currently have 2 Apps,

  1. Built in Unity
  2. Built in VS

I have a DLL that both reference, and as far as that goes, it works.(ie, they can both access the associated scripts, variables, and methods.)

What I would like to do, is edit a value in the VS application, and for the Unity Application to respond accordingly.

What I’ve tried. After creating a static variable in a static class. I then changed the value of said variable in the Visual Studio App, and checked to see if it had changed in the Unity app reference. It did not.

Easiest thing to do would be to have a file (e.g. JSON) that both programs can see; the Unity app checks the file’s metadata several times a second, and if the file’s last modified date changes, it loads the file’s new data.

@StarManta I appreciate you speedy response.

Though it is a solution, and I hope that when future people have the same question they are able to use that solution. The team I’m on has shied away from external files including txt, JSON, etc. If we can’t find another solution this will be the way we go but we’d prefer something like: MemoryMappedFile, unfortunately, this system was implemented in .NET 4.0 ergo can not be used with Unity (which uses .NET 3.5) so I’m trying to find something between writing a new class in .Net 3.5 based on the win32 Methods: Managing Memory-Mapped Files | Microsoft Learn

and the .NET 4.0 class set for memory mapping: Memory-Mapped Files - .NET | Microsoft Learn

If anyone has solved this, we’d love to see a post. Otherwise, if we find a way to solve it, we will post our result on this thread.

The Solution: To perform the function of the MemoryMappedFile, a class that allows IPC, or the ability to share memory locations between separate processes, check out the following library: GitHub - justinstenning/SharedMemory: C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)

With it, I was able to do exactly what I wanted. To be able to create and manipulate a variable from one application, and then access that variable from a separate application, without having to create a file, and then ping it several times a second to check for updates.

If you were looking for a solution to MemoryMappedFile in .NET 3.5, this is it.