![]() StartCoroutine(fadeInOutSaveGame. Yield return new WaitForSeconds(timeToStartSaving) Public IEnumerator AuatomaticSaveWithTime() ObjectsToSave.Add(objectsWithGenerateGuid.gameObject) If (objectsWithGenerateGuid.Count > 0 & objectsToSave.Count = 0)įor (int i = 0 i < objectsWithGenerateGuid.Count i++) Learn how to create a GUID from Visual Studio, how to Create GUID programmatically us. Var objectsWithGenerateGuid = GameObject.FindObjectsOfType().ToList() This video tutorial explains different ways to create a GUID in C.Net. Var z = y.Where(component => component is IStateQuery).ToList() ĭictionary zz = z.ToDictionary(sq => (sq as IStateQuery).UniqueId.ToString(), sq => sq as IStateQuery) įoreach (KeyToValue keyvalue in loadedComponents) Var y = objectToSetState.GetComponents() If (uniqueIdToObject.ContainsKey(saveObject.gameObjectUniqueID)) SaveGame saveGame = JsonUtility.FromJson(saveString) įoreach (var saveObject in saveGame.saveObjects) SaveString = SaveSystem.Load(Folder, FileName) ToDictionary(o => o.GetComponent().uniqueGuidID, o => o) Var objectsToLoad = UpdateObjectsToSave() ĭictionary uniqueIdToObject = objectsToLoad Public void Load(string Folder, string FileName) This very detailed answer to a similar question on stack overflow explains why GUIDs arent random, but are highly structured, statistically unique values. String json = JsonUtility.ToJson(saveGame) Following are steps required to generate GUID in Typescript applications First, Install the typescript-guid library using the npm command npm i typescript-guid -save It adds the dependency to package.json Once the package is installed on a typescript project. Var stateQuer圜omponent = x.Where(component => component is IStateQuery).ToList() ĬomponentsState.Add(new KeyToValue(w.UniqueId.ToString(), w.GetState())) Var objectsToSave = UpdateObjectsToSave() Public void Save(string Folder, string FileName) Public FadeInOutSaveGameText fadeInOutSaveGame Then use it like this in the Save and Load methods : using System In the TestState script I'm using the IStateQuery : public class StateTest : MonoBehaviour, IStateQuery Start is called before the first frame update M_state = JsonUtility.FromJson(jsonString) Public class StateTest : MonoBehaviour, IStateQuery I wonder why not use the same new instance technic in both cases, why or what the tool for creating guide number 5 is for ? using System Public class GenerateGuid : MonoBehaviour This is when creating a new instance : using System So I wonder what is the difference between creating a new guid instance or selecting in visual studio tools > create guide. ![]() The problem is that on each object I want to add to this state script format I need manually to generate a new GUID copy it and paste it to the code and it's a bit annoying. The guide is not the same as in the screenshot it's just for example. ![]() In my state script I select Tools > Create GUID > New GUID > Copy ![]()
0 Comments
Leave a Reply. |