1. Home
  2. Docs
  3. Save Game Pro
  4. Tutorials
  5. Creating Custom Type

Creating Custom Type

You can create custom types Manually or Automatically using Type Creator.

Automatically using Type Creator

In the Unity Editor, at the Toolbar, Go to Window > Save Game Pro > Type Creator to open Type Creator window.

now in this window you can search for the desired type and create it at the specified path, if the Type you are looking for is a custom type that is created by you, you can find it at Assembly-CSharp assembly, and searching in the Types panel for the type name.

Manually

Create a new C# script and name it SaveGameType_{Your Type Name Here} and open it.

Now, place this template code in the script and replace the Type name and script name with your own values:

Now, replace the MyCustomType with your own desired type.

Here is a example type that helps you make your desired type:

Now, use the same approach to make your custom type savable.

Note: The ReadInto is used for classes and not for structs, that means if your custom type is a class, you should use both Read and ReadInto.

Note: If your type is a Component, you can SaveGameType.CreateComponent to initialize the component with a game object, we use this inside Read method, here is an example of Component type:

Was this article helpful to you? Yes 1 No

How can we help?