Hi, thanks for replying, this is really cool and is very close to a solution.
I had to first put the check to destroy on Awake() as it was still calling Jolt() first for some reason.
Have 2 problems now.
When I save and play again, firstly even though the object is disabled, It's still trying to access my other script
with
Code: Select all
wind = GameObject.Find("WindZone").GetComponent<Wind>();
But that line of code isn't being called anymore. Tried putting that in awake too but it didn't work.
And lastly, I'm getting
Code: Select all
IOException: Sharing violation on path "MY APPDATA PATH WITH SAVEDATA.ES3"
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
ES3Internal.ES3FileStream..ctor (System.String path, ES3Internal.ES3FileMode fileMode, System.Int32 bufferSize, System.Boolean useAsync) (at Assets/Plugins/Easy Save 3/Scripts/Streams/ES3FileStream.cs:12)
(wrapper remoting-invoke-with-check) ES3Internal.ES3FileStream..ctor(string,ES3Internal.ES3FileMode,int,bool)
ES3Internal.ES3Stream.CreateStream (ES3Settings settings, ES3Internal.ES3FileMode fileMode) (at Assets/Plugins/Easy Save 3/Scripts/Streams/ES3Stream.cs:24)
ES3Reader.Create (ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:308)
ES3.Load[T] (System.String key, T defaultValue, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:306)
ES3.Load[T] (System.String key, T defaultValue) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:278)
HeavyObject.Awake () (at Assets/Scripts/HeavyObject.cs:12)
UnityEngine.Object:Instantiate(GameObject)
ES3Types.ES3Type_ES3PrefabInternal:Read(ES3Reader) (at Assets/Plugins/Easy Save 3/Scripts/ES3Prefab.cs:131)
ES3Reader:ReadObject(ES3Type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader:Read(ES3Type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Types.ES3Type_GameObject:ReadObject(ES3Reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:106)
ES3Types.ES3ObjectType:Read(ES3Reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:40)
ES3Reader:ReadObject(ES3Type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader:Read(ES3Type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Types.ES3ArrayType:Read(ES3Reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ArrayType.cs:57)
ES3Reader:Read(ES3Type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:240)
ES3Reader:Read(String, GameObject[]) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:178)
ES3:Load(String, GameObject[], ES3Settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:310)
ES3AutoSaveMgr:Load() (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:42)
ES3AutoSaveMgr:Awake() (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:56)
Appreciate the help alot.