The name 'ES3' does not exist in the current context?

Discussion and help for Easy Save 3
Sandstedt
Posts: 2
Joined: Mon Aug 15, 2022 2:57 pm

Re: The name 'ES3' does not exist in the current context?

Post by Sandstedt »

I have this problem as well. The problem from my side is that I'm using Assembly Definitions. So the script I'm referencing ES3 doesn't have the correct Assembly Definitions available.

I got to the point that I could create my own that worked in the editor, but Unity crashed when trying to build (Android).

But I'm so tired of Assembly Definition files, so will probably just remove then entirely from my project.
nanodeath
Posts: 2
Joined: Fri Aug 19, 2022 2:46 pm

Re: The name 'ES3' does not exist in the current context?

Post by nanodeath »

Ha, I wish I'd seen page 2 of this thread 10 minutes ago.

Yes, if you have your own Assembly Definition in your Assets/Scripts/ directory like I do, then you won't be able to compile against source in Assets/Plugins/.

To fix that, the answer is...more assembly definitions.

I created a new Assembly Definition in Assets/Plugins/ called "Plugins", and then referenced it from my "Scripts" Assembly Definition. Works fine.

Unity has docs on how to create Assembly Definitions and update references.

It'd be kinda nice if ES3 shipped source + DLL like BehaviorDesigner does...
Coldwynn
Posts: 22
Joined: Sun Oct 30, 2022 11:56 am

Re: The name 'ES3' does not exist in the current context?

Post by Coldwynn »

Hi, Is there an incompatibility between ES3 and Unity 2021.3.14f1? I just switched to that version, and while my older projects seemed to work fine, the newer ones always come up with CS0103 ..."The name 'ES3' does not exist in the current context."

Here's what I did to repeat the issue with a new project:

1. Start with a new project in Unity Hub
2. In the new scene I go to Window > Assets Store, search for "Easy Save". The item shows I've purchased it, and I click on the button "Open in Unity".
3. I navigate to Window > Asset Manager and download / import all (using the buttons at the bottom of the panel)
4. Under Assets > Easy Save 3 > Add Easy Save Manager, I include Easy Save 3 Manager in the scene hierarchy.
5. I attach a UI > canvas, then attach a UI > image to the canvas.
6. I create a script and make it a component of the canvas, I drag the canvas to the reference in the Inspector
7. In the MonoBehaviour I have this (being lazy, just used the Start and Update Methods already there):

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestScript : MonoBehaviour
{
    var double vDub;
    var double takes;

    void Start()
    {
        vDub = 123.45;
        ES3.Save("vDub", vDub);
    }

    void Update()
    {
        takes = ES3.Load("vDub", vDub);
        Debug.Log("This is what it " + ToString(takes));
    }
}
Sometimes, the first ES3 line will get the squiggly red line and throw the error, sometimes that is accepted but there will be an error on debug.

Stranger still, I had extra empty lines and the second ES3 containing statement landed on line 21. When I erased the empty lines, the error statement still has the error on 21 (even if I erase the "takes = ES3 ..." line and there is no longer any line 21.

I am thoroughly lost.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: The name 'ES3' does not exist in the current context?

Post by Joel »

Hi there,

There are no issues with Easy Save and this version of Unity that we’re aware of, and it appears to work fine at our end.

The error indicates that Unity isn’t compiling the code, which isn’t something we have control over. You should check that there are no other errors in your console as errors in other scripts will prevent Unity from being able to compile.

Usually restarting Unity will resolve this if it’s not due to an error in another script but otherwise you would need to contact Unity for a resolution as it would indicate a bug at their end.
Stranger still, I had extra empty lines and the second ES3 containing statement landed on line 21. When I erased the empty lines, the error statement still has the error on 21 (even if I erase the "takes = ES3 ..." line and there is no longer any line 21
This would indicate that Unity is failing to compile.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Coldwynn
Posts: 22
Joined: Sun Oct 30, 2022 11:56 am

Re: The name 'ES3' does not exist in the current context?

Post by Coldwynn »

You're right, there was some offending script-errors elsewhere. Sorry to bother you with my incomplete understanding.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: The name 'ES3' does not exist in the current context?

Post by Joel »

Not a problem, I’ve made the same mistake myself in the past :) Let me know if you run into any other issues.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply