question

roc4u avatar image
roc4u asked

Unity SDK Installation Issue - 'error CS0117: `Environment' does not contain a definition for `ProcessorCount''

Installed the editor extensions which through that I logged in and installed the SDK, but I get the error, error CS0117: `Environment' does not contain a definition for `ProcessorCount', any idea what this is, so far my searching has returned nothing.

sdks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image
1807605288 answered

What version of Unity are you using?

7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

roc4u avatar image roc4u commented ·

Pretty sure it's the latest, but I will check when I am at home.

FYI, on another project this all worked, just with this different project it seems to be broken. Here is a bit of history with this project, just in case it helps.

First of all it had another back-end set up in it, Gamesparks, I was evaluating it and found things I did not like so then I removed it and am trying to get set up with PlayFab. I might have messed up that process of removing it, or the fact that it existed before might have something to do with this.

Another thing is after removing the other back-end package, I imported the SDK before I imported the Extensions, which when I saw this error I thought I had done it backwards, so I removed them both and did the extensions first and then use the interface to imiport the SDK.

So something in that mess probably caused this to happen.

0 Likes 0 ·
roc4u avatar image roc4u roc4u commented ·

My Unity version is 5.6.0f3 64bit.

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ roc4u commented ·

I can't really say for certain what's going on in this case. The variable your environment says is missing, is right in the middle of a bunch of other variables that are all defined together in the Unity DLL. It shouldn't say that only that one is missing, it should be all or nothing.

In short, I believe your project is internally corrupted somehow. Each of the steps below is an escalating set of steps that may address the problem. The latter steps may do further damage to your project, and it's unclear to me how drastic of steps you're willing to take.

MOSTLY HARMLESS:

Close Unity before proceeding.

In Windows, navigate to your project folder, and find the "Assets" folder. Beside it, you should find any or all of the following folders: .vs, Temp, Library

Also locate several files of the format Source.*.csproj and Source.sln

All of these files and folders are temporary folders/files and cache folders/files.

Delete them. (Don't delete Assets folder)

Reload the project in Unity.

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ roc4u commented ·

KINDA UNSAFE:

Close Unity before proceeding.

ProjectSettings folder contains files that are not temporary, but can often become corrupted. If deleting the temporary files above does not resolve the issue, then close your Unity project again, and delete everything in the project folder except Assets, including ProjectSettings and all the temporary files listed above (they will get re-created when you delete them).

(Don't delete Assets folder - delete everything else)

Reload the project in Unity.

PLAYING WITH FIRE:

Close Unity before proceeding.

If you continue to have issues at this point, I would suspect that you have some local code in your project that's over-loading, replacing, or conflicting some classes/variables that would normally be defined in Unity. Resolving that is a matter of rebuilding your project with only your code, to remove any leftover code that you may have leftover from another SDK or code integration. That's basically "rebuild your project code one file at a time" and you're on your own at that point.

0 Likes 0 ·
roc4u avatar image roc4u 1807605288 ♦ commented ·

Thanks Paul, I will probably try the first option, if that doesn't work I will just start a new project and migrate stuff over, though making sure the SDK stuff works before I do.

A lot of the stuff should be simple and pretty quick, just worried I'll have to recreate the UI stuff I did. :( I hope there is a way of migrating all of that over too.

As of now I cannot iterate on anything on the project so that is better than not being able to work on it at all.

0 Likes 0 ·
Show more comments
roc4u avatar image
roc4u answered

Well, I figured it out, I had a class for my game named Environment . . so when it looked for that variable(or a function, not sure), it looked in my script. I gotta rename these better. I changed that to something else and it works now.

Thanks for the help again @Paul Gilmore

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

That's weird. Like I said before, I'd have expected many more problems than just the one Environment.ProcessorCount issue in that case. At any rate, I'm glad it worked out.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.