http://www.moodkie.com/forum/viewtopic.php?f=4&t=522
Completed these steps but now using a different script trying to spawn objects in run time1.Add a UniqueObjectManager and UniqueSaveManager script to the scene.
2.Add a UniqueID script to each of the prefabs you want to create at runtime and set the UniqueID's 'prefabName' field to the name of this prefab.
3.Add the prefabs to the UniqueObjectManager's 'prefab' field.
4.Add a UniqueID script to all of the scene objects you want to save, or might have child objects which need saving.
5.Add these scene objects to the scene objects array in the UniqueObjectManager
Code: Select all
using UnityEngine;
using System.Collections;
public class CreateObject : MonoBehaviour {
void OnMouseDown() {
UniqueObjectManager.InstantiatePrefab(string Block);
}
}
Assets/BuildBox/Scripts/CreateObject.cs(12,70): error CS1525: Unexpected symbol `Block', expecting `.'
Also I wish to delete objects on the fly too there is a small delete icon players can drag objects to destroy individual objects
Code: Select all
using UnityEngine;
using System.Collections;
public class DestroyBuildObjects : MonoBehaviour
{
void OnTriggerEnter (Collider col)
{
if (col.gameObject.tag == "EditorTouch") {
UniqueObjectManager.DestroyObject(GameObject Block);
}
}
}
Assets/BuildBox/Scripts/DestroyScripts/DestroyBuildObjects.cs(13,74): error CS1525: Unexpected symbol `Block'
This tutorial seems ideal as wish to save whatever objects spawned by the players and saved when they exit the scene and also if they delete the objects the save is updated to show that. Please advise thank you.