keiwando / evolution

A sandbox game/simulator that demonstrates machine learning with evolutionary algorithms.
https://keiwan.itch.io/evolution
361 stars 56 forks source link

JSON-related errors while trying to build the project in Unity. #19

Closed 0xRETR0 closed 10 months ago

0xRETR0 commented 10 months ago

Hi,

I was trying to build the project in Unity, hoping to mess around it a bit, however was met with compilation errors while trying to do so. Unity displays 48 errors total, but they all boil down to "Assets\Scripts[Data\x.cs(x, y)]/[Scenes\Structures\x.cs(x, y): error CS0246: The type or namespace name 'JObject'/'IJsonConvertible' could not be found (are you missing a using directive or an assembly reference?)". I'm using the Unity version specified in the repo, and I believe I should have all necessary dependencies installed as well. How would I go about fixing this? Any help would be appreciated, thanks.

keiwando commented 10 months ago

I just downloaded a fresh clone of this repo and opened it with Unity 2018.4.36f1 and it compiled immediately without any errors.

The JObject, IJsonConvertible etc. files are in Assets/JSON/Scripts and should end up in the main assembly (Assembly-CSharp.dll), so it should recognize the types without issues.

At this point, I have no idea why it's working for me but not working for you. Are you sure you didn't miss some other error in the console that is unrelated to the JSON error?

0xRETR0 commented 10 months ago

The JObject, IJsonConvertible etc. files are in Assets/JSON/Scripts and should end up in the main assembly (Assembly-CSharp.dll), so it should recognize the types without issues.

Figured this out as well, which has had me really baffled.

Are you sure you didn't miss some other error in the console that is unrelated to the JSON error?

Positive, each and every error refers to either JObject or IJsonConvertible.

At this point I suppose I'll just try and clone the repo again, perhaps it'll just magically work. I am also using a fairly new PC, and although I believe I should have all the necessary components, do you reckon I could be missing some key dependencies, or have any idea what's worth checking/reinstalling?

0xRETR0 commented 10 months ago

Man, fuck me. I cloned the repo again, unpacked it with 7zip, fired it up in Unity, and it worked like a charm. Compared the old folder, which I unpacked with Windows' default utility, with the new one, and it seems like for some reason Windows decided that no one will notice if it won't unpack a few files. I suppose the fix here is to not use default Windows software. Thanks for the help and sorry for the false alarm, closing the issue.

keiwando commented 10 months ago

No worries. Not being able to trust WIndow's built in zip utility is good knowledge for me to have as well.