我想你说的是停止场景后持久的游戏对象。
使gameObject实例在场景层次结构中弹出并在场景播放和停止后停留的唯一可能性是使用CustomEditors。
你要知道,Unity编辑器是基于Unity Gui的,所以你可以很容易地添加按钮,让它运行你编写的一些特定的脚本,在windows菜单里面(例如)。
但您也可以自定义鼠标右键单击场景层次结构,以允许人们创建允许的游戏对象的实例,并将此创建的实例直接添加到场景中先前单击的游戏对象的子级等...
或者创建自己的工具脚本,并将其作为组件添加到 Gameobject 上,并为其指定特定布局并由 Unity 编辑器渲染。
逐步使用customEditor:
1 - 在 Assets/ 根项目层次结构中创建一个名为 Editor 的文件夹
2 - 创建一个像下面这样的脚本,它使用对UnityEditor 的引用并添加您可以使用注释属性。最后你必须让你的类扩展 From Editor 类。
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
// uncomment this line bellow if you want to create customEditor script which you will be able to use on gameObject as component.
// typeof give script type , it's a script created as component and extending from Monobehaviour, he contain value etc.. he could be manipulated from this CustomEditor script via button who call Methodes.
//[CustomEditor(typeof(YourScriptComponent))]
public class MyNewCustomEditor : Editor
{}
有关 customEditors 脚本的更多示例,请查看统一文档:http://docs.unity3d.com/ScriptReference/Editor.html
3 - 创建要在场景播放模式之外使用和调用的方法。
您必须在 OnInspectorGUI() 函数中创建按钮,该函数将调用您的方法以在场景中实例化一些游戏对象。
4 - 警告,要实例化预制件等资源,您必须将所需资源放在名为 Resources 的文件夹中,并在脚本中使用 Resources.Load() 方法。
查看文档了解更多信息,使用起来非常简单:http://docs.unity3d.com/ScriptReference/Resources.Load.html
希望对你有所帮助,再见。