1
\$\begingroup\$

I am making the chess interface I designed for a game. I am using the process to get answers from a stock fish binary:

stockfish = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                    Arguments = "",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardInput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true
                }

            };

The problem I face is it worked for my Windows build but for mobile package build it won't work with the executable. Is there a way around it?

\$\endgroup\$
2
\$\begingroup\$

This line should only ever work in Windows version (or for versions that your VS supports):

FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",

For Unity's builder, you need to use Application.dataPath or Application.persistentDataPath. I've had success with using both, the former for accessing the game folder and the latter for saving or loading files.

\$\endgroup\$
  • 1
    \$\begingroup\$ You'd also need a version of the external binary compiled for your target platform, as the exe is a Windows executable. \$\endgroup\$ – DMGregory Dec 22 '16 at 14:42
  • \$\begingroup\$ What is the stranded binary for Android and how can i access it ? Can you guide me through on it. \$\endgroup\$ – Ahmad Iftikhar Dec 26 '16 at 10:18
  • \$\begingroup\$ @AhmadIftikhar apk, which you get by changing the build target in Unity. \$\endgroup\$ – Draco18s Jan 8 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.