- Home /
Question by
DarkArtsProdigy · Jan 25, 2014 at 04:18 PM ·
c#programmingserialization
Bringing Down the Buttons
I downloaded the UnitySerializer asset and I've gotten it to work for me (finally). Anyway, I want to use the TestSerialization.cs script as the mission selection tool on the main menu, but when I use it the saved games buttons are stuck on the top left corner when I need to move them down a bit. How would I do that because I've tried a lot of things but it's hard for me. Here's the code if you don't have it on you:
using UnityEngine;
using System.Collections;
using Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Collections.Generic;
using System;
using System.Linq;
public class TestSerialization : MonoBehaviour
{
void OnEnable()
{
//LevelSerializer.Progress += HandleLevelSerializerProgress;
}
void OnDisable()
{
//LevelSerializer.Progress -= HandleLevelSerializerProgress;
}
static void HandleLevelSerializerProgress (string section, float complete)
{
Debug.Log(string.Format("Progress on {0} = {1:0.00%}", section, complete));
}
void OnGUI()
{
if(GUILayout.Button("Save"))
{
//Save the game with a prefix of Game
var t = DateTime.Now;
LevelSerializer.SaveGame("Game");
Radical.CommitLog();
Debug.Log(string.Format("{0:0.000}", (DateTime.Now - t).TotalSeconds));
}
//Check to see if there is resume info
if(LevelSerializer.CanResume)
{
if(GUILayout.Button("Resume"))
{
LevelSerializer.Resume();
}
}
if(LevelSerializer.SavedGames.Count > 0)
{
GUILayout.Label("Available saved games");
//Look for saved games under the given player name
foreach(var g in LevelSerializer.SavedGames[LevelSerializer.PlayerName])
{
if(GUILayout.Button(g.Caption))
{
g.Load();
}
}
}
}
// Update is called once per frame
void Update()
{
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613131414im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Help needed on creating a options menu 1 Answer
Transform object issues 1 Answer