if you run the exe as another user - your personal mapped network drive is not available
If you run the exe as another user - it may not have permission to see it
if you run the exe as a server - remote drives arent available
Some network drives seem to be allergic to being accessed directly
so I would need to move this off of anything OneDrive related surely. How would I go about making sure the project has perms for the file? All of this is internal memory, so nothing fancy or remote.
Oh lord, the most horrific thing you can do to unity is work on it on a onedrive area…
One thing to note, your one drive area, isnt always the path you think it is
If you arent running as another user, it is 100% running as you and you can see it, it isnt a permissions thing… unless you run it as a service
it is running on system admin, so perms shouldn’t be the issue? it’s still giving the same exception even after I move the file location and changed the path to another drive entirely. so what sort of troubleshooting can I do here other than that? I’ve checked perms, I’ve moved it around, I double checked the path, and even sent my buddy a screenshot of the file which he confirmed did exist. I’m at a loss
full path, just a txt doc so I can connect unity to streamerbot without having to spend a week learning websockets for both programs. there’s nothing to put a debug on:
ok so this says where ever i made the home of running i expect a folder called path.
so if you ran a build it would be like c:\users\yourname\documents\unity\project\build\path … but if you run it during dev time it might be only as far as project but then assets\path … so…
NEVER place a Unity project under a cloud drive folder! Catastrophic data loss is almost guaranteed if you work from more than one place, more so if others work in the same project. And if you use it only for backup reasons, your backup will easily be bloated by a factor of 10 or more.
Use source control! Cloud drives do not warn about conflicts, nor do they merge - they just overwrite files.
NEVER run Unity as admin! Unity warns you about this, for good reason. Even a simple scripting mistake could delete system or personal files with no warning, no going back. Plus the usual, you know, hackers love it. Scammers, Phishers, Bitcoin Miners, etc etc
If it’s “just” the OS account then okay, as long as UAC is not force disabled.
What do you need this for? I have a hunch that it’s either an inadequate solution, or wholly superfluous because Unity provides better tools for the job (ie AssetDatabase if this is for editor).
At runtime, there shouldn’t be any need to “watch” the user’s file system. You can rely on things like the app losing focus, while the user copies some music to his music folder for instance, and then tabs back into the game.
I’m using this for a Twitch Stream feature which sends the username of the person who sent the command to a txt file which would then be read into a string while also activating a prize wheel that spins sending that data to another txt file to then be read by streamerbot.
so the connection flowchart would look like: twitchAPI → streamerbot → .txt1 → unity → .txt2 → streamerbot → twitchAPI
I’m aware that websockets would be a better solution, it’s on my list of things to learn, but I’d just like to get something working quickly so that I can get both endpoints operating. then I’ll at least know that while implementing websockets everything else is up and running as need be.
TLDR this is all local, yes I need to know if the file was modified, it’s not an adequate solution, it’s an incredibly jank one but it will do XD
Unity is not stored on a cloud drive, it’s local
I am the admin of my system is all that I mean
the user is me, I don’t care if I need to watch my file system lol it’s what I’m doing for this silly little project to entertain maybe 15 people.
I would like to know how I can fix this I have been on the forum trying to resolve this issue for the whole day. please, anyone lmao
Why would it run in the scripts folder? once compiled there is arguably no scripts folder, mostly the editor runs from assets, but, other things can move it, you can change… ask it where it is, hence my point, it can surprise you
So, most likely its c::\users\yourname\documents\unity\project\assets
but, it might not be, so, check where it is… also note, when its built and run it wont run from there and that scripts folder will be only a distant dream… as your build has no structure like that.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class leftWheel : MonoBehaviour
{
public float genSpeed;
public float subSpeed;
public bool isSpinning = false;
public bool changed;
public FileSystemWatcher fileWheelInput;
// Start is called before the first frame update
void Start()
{
FileSystemWatcher fileWheelInput = new FileSystemWatcher(@"C:\Users\user\Documents\Streamerbot\redeem files\used_wheel.txt");
fileWheelInput.NotifyFilter = NotifyFilters.LastWrite;
fileWheelInput.Changed += OnChanged;
}
// Update is called once per frame
void Update()
{
if (isSpinning == true)
{
transform.Rotate(0,0,genSpeed,Space.World);
genSpeed -= subSpeed;
}
if (genSpeed <= 0)
{
genSpeed = 0;
isSpinning = false;
}
if (changed)
{
SpinWheel();
changed = false;
}
}
public void SpinWheel()
{
genSpeed = UnityEngine.Random.Range(2.000f, 5.000f);
subSpeed = UnityEngine.Random.Range(0.003f, 0.009f);
isSpinning = true;
}
public void OnChanged(object sender, FileSystemEventArgs e)
{
changed = true;
}
}