diff --git a/Assets/Scenes/otherscenedemo.txt b/Assets/Scenes/otherscenedemo.txt new file mode 100644 index 0000000..8659e3b --- /dev/null +++ b/Assets/Scenes/otherscenedemo.txt @@ -0,0 +1,126 @@ +gameobject Cube +tag Untagged layer 0 +0.00000 -2.48280 0.00000 +0.00000 0.00000 0.00000 1.00000 +1.00000 1.00000 1.00000 +children 0 +components 3 + UnityEngine.MeshFilter 1 + property sharedMesh builtinmesh UnityEngine.Mesh = Cube + UnityEngine.BoxCollider 4 + property center primitive UnityEngine.Vector3 = (0.0, 0.0, 0.0) + property size primitive UnityEngine.Vector3 = (1.0, 1.0, 1.0) + property extents primitive UnityEngine.Vector3 = (0.5, 0.5, 0.5) + property isTrigger primitive System.Boolean = False + UnityEngine.MeshRenderer 5 + property castShadows primitive System.Boolean = True + property receiveShadows primitive System.Boolean = True + property sharedMaterials array UnityEngine.Material[] = 1 + builtinmaterial UnityEngine.Material = Default-Diffuse + property lightmapIndex primitive System.Int32 = -1 + property lightmapTilingOffset primitive UnityEngine.Vector4 = (1.0, 1.0, 0.0, 0.0) + +gameobject Cube +tag Untagged layer 0 +3.00000 -2.48280 2.00000 +0.00000 0.00000 0.00000 1.00000 +1.00000 1.00000 1.00000 +children 1 + gameobject Cube + tag Untagged layer 0 + -10.00000 6.00000 0.00000 + 0.00000 0.00000 0.00000 1.00000 + 1.00000 1.00000 1.00000 + children 0 + components 3 + UnityEngine.MeshFilter 1 + property sharedMesh builtinmesh UnityEngine.Mesh = Cube + UnityEngine.BoxCollider 4 + property center primitive UnityEngine.Vector3 = (0.0, 0.0, 0.0) + property size primitive UnityEngine.Vector3 = (1.0, 1.0, 1.0) + property extents primitive UnityEngine.Vector3 = (0.5, 0.5, 0.5) + property isTrigger primitive System.Boolean = False + UnityEngine.MeshRenderer 5 + property castShadows primitive System.Boolean = True + property receiveShadows primitive System.Boolean = True + property sharedMaterials array UnityEngine.Material[] = 1 + asset UnityEngine.Material = Assets/Materials/CustomMaterial.mat, CustomMaterial, e9b851d350fc14be09ce3ba99babfe07 + property lightmapIndex primitive System.Int32 = -1 + property lightmapTilingOffset primitive UnityEngine.Vector4 = (1.0, 1.0, 0.0, 0.0) +components 3 + UnityEngine.MeshFilter 1 + property sharedMesh builtinmesh UnityEngine.Mesh = Cube + UnityEngine.BoxCollider 4 + property center primitive UnityEngine.Vector3 = (0.0, 0.0, 0.0) + property size primitive UnityEngine.Vector3 = (1.0, 1.0, 1.0) + property extents primitive UnityEngine.Vector3 = (0.5, 0.5, 0.5) + property isTrigger primitive System.Boolean = False + UnityEngine.MeshRenderer 5 + property castShadows primitive System.Boolean = True + property receiveShadows primitive System.Boolean = True + property sharedMaterials array UnityEngine.Material[] = 1 + builtinmaterial UnityEngine.Material = Default-Diffuse + property lightmapIndex primitive System.Int32 = -1 + property lightmapTilingOffset primitive UnityEngine.Vector4 = (1.0, 1.0, 0.0, 0.0) + +gameobject Directional light +tag Untagged layer 0 +740.81120 66.71914 1054.85100 +0.37889 0.00000 0.00000 0.92544 +1.00000 1.00000 1.00000 +children 0 +components 1 + UnityEngine.Light 12 + property type primitive UnityEngine.LightType = Directional + property color primitive UnityEngine.Color = (1.000, 1.000, 1.000, 1.000) + property intensity primitive System.Single = 0.5 + property shadows primitive UnityEngine.LightShadows = None + property shadowStrength primitive System.Single = 0.8 + property shadowConstantBias primitive System.Single = 0.07 + property shadowObjectSizeBias primitive System.Single = 0.01 + property attenuate primitive System.Boolean = True + property range primitive System.Single = 10 + property spotAngle primitive System.Single = 30 + property renderMode primitive UnityEngine.LightRenderMode = Auto + property cullingMask primitive System.Int32 = -1 + +gameobject Links +tag Untagged layer 0 +8.54124 9.88922 -6.45947 +0.00000 0.00000 0.00000 1.00000 +1.00000 1.00000 1.00000 +children 0 +components 1 + TextSceneLinkTest 4 + field materialList array UnityEngine.Material[] = 0 + field prefabLink asset UnityEngine.GameObject = Assets/Prefabs/Capsules.prefab, Capsules, f0529f741bc2540eea3ec100e446c639 + field colliderLink scenelink UnityEngine.BoxCollider = /Cube/Cube + field nextScene primitive System.String = scenedemo + +gameobject Main Camera +tag MainCamera layer 0 +0.00000 1.00000 -10.00000 +0.00000 0.00000 0.00000 1.00000 +1.00000 1.00000 1.00000 +children 0 +components 3 + UnityEngine.Camera 15 + property fov primitive System.Single = 60 + property near primitive System.Single = 0.3 + property far primitive System.Single = 1000 + property fieldOfView primitive System.Single = 60 + property nearClipPlane primitive System.Single = 0.3 + property farClipPlane primitive System.Single = 1000 + property orthographicSize primitive System.Single = 100 + property orthographic primitive System.Boolean = False + property isOrthoGraphic primitive System.Boolean = False + property depth primitive System.Single = -1 + property cullingMask primitive System.Int32 = -1 + property backgroundColor primitive UnityEngine.Color = (0.192, 0.302, 0.475, 0.020) + property rect primitive UnityEngine.Rect = (0.00, 0.00, 1.00, 1.00) + property clearFlags primitive UnityEngine.CameraClearFlags = Skybox + property depthTextureMode primitive UnityEngine.DepthTextureMode = None + UnityEngine.GUILayer 0 + UnityEngine.AudioListener 1 + property velocityUpdateMode primitive UnityEngine.AudioVelocityUpdateMode = Dynamic + diff --git a/Assets/Scenes/otherscenedemo.txt.meta b/Assets/Scenes/otherscenedemo.txt.meta new file mode 100644 index 0000000..d8ac9a3 --- /dev/null +++ b/Assets/Scenes/otherscenedemo.txt.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 7adf941b4440fba40afcdc066c2e50ce diff --git a/Assets/Scenes/scenedemo.txt b/Assets/Scenes/scenedemo.txt index 774a491..07db8bd 100644 --- a/Assets/Scenes/scenedemo.txt +++ b/Assets/Scenes/scenedemo.txt @@ -97,12 +97,13 @@ tag Untagged layer 0 1.00000 1.00000 1.00000 children 0 components 1 - TextSceneLinkTest 5 + TextSceneLinkTest 6 field materialList array UnityEngine.Material[] = 0 field goLink scenelink UnityEngine.GameObject = /spheres/UniqueName field transformLink scenelink UnityEngine.Transform = /Capsule/Capsule field prefabLink asset UnityEngine.GameObject = Assets/Prefabs/Capsules.prefab, Capsules, f0529f741bc2540eea3ec100e446c639 field colliderLink scenelink UnityEngine.BoxCollider = /Cube/Cube + field nextScene primitive System.String = otherscenedemo gameobject Main Camera tag MainCamera layer 0 diff --git a/Assets/Scripts/Editor/TextScene/TextSceneMonitor.cs b/Assets/Scripts/Editor/TextScene/TextSceneMonitor.cs index 439a118..9ff5c90 100644 --- a/Assets/Scripts/Editor/TextScene/TextSceneMonitor.cs +++ b/Assets/Scripts/Editor/TextScene/TextSceneMonitor.cs @@ -220,6 +220,38 @@ private void Update() if (saveAndReload.Length > 0 && saveAndReloadTimer <= 0) { + ///FIXME: Unity sometimes puts a lock on the scenes we try to save, this is a CRUEL way to + ///get around it. This problem seems to be a lot more frequent on Windows than on MacOSX. + /// + ///Repro-steps: *Comment out the try/catch + /// *Clean out tempscenes-folder. + /// *Open up a scene (LEVEL1) from build settings, hit play + /// *Answer "yes" to the dialog box whining about invalid build settings + /// *Hit play again, once it has completed doing its stuff. + /// *While playing, do something to make the game + /// change to another level (LEVEL2). + /// *Stop playing, you should now be back in the level where you + /// hit play from. + /// *Try to switch to the level you switched to in-game (LEVEL2). + /// *You should, after the progress bar has completed, be prompted + /// with an error saying Unity could not move file from Temp/Tempfile + /// + try + { + FileStream f = File.OpenWrite(saveAndReload); + f.Close(); + } + catch + { + Debug.LogWarning("HACK: Getting around 'access denied' on temp files!"); + + //HACK: This seems to make Unity release the file so we can try to save it in a new go. + EditorApplication.OpenScene(saveAndReload); + + TextSceneDeserializer.Load(EditorHelper.GetProjectFolder() + TextScene.TempToTextSceneFile(EditorApplication.currentScene), saveAndReloadCallback); + return; + } + EditorApplication.SaveScene(saveAndReload); EditorApplication.OpenScene(saveAndReload); diff --git a/Assets/Scripts/TextScene/TextSceneLinkTest.cs b/Assets/Scripts/TextScene/TextSceneLinkTest.cs index 48c2df7..c074113 100644 --- a/Assets/Scripts/TextScene/TextSceneLinkTest.cs +++ b/Assets/Scripts/TextScene/TextSceneLinkTest.cs @@ -1,16 +1,28 @@ -/// -/// Copyright (c) 2010 TerraVision AS -/// See LICENSE file for licensing details -/// - -using UnityEngine; - -class TextSceneLinkTest : MonoBehaviour -{ - public Material[] materialList; - public GameObject goLink; - public Transform transformLink; - public GameObject prefabLink; - public BoxCollider colliderLink; -} - +/// +/// Copyright (c) 2010 TerraVision AS +/// See LICENSE file for licensing details +/// + +using UnityEngine; + +class TextSceneLinkTest : MonoBehaviour +{ + public Material[] materialList; + public GameObject goLink; + public Transform transformLink; + public GameObject prefabLink; + public BoxCollider colliderLink; + + public string nextScene; + + protected void OnGUI() + { + if (GUI.Button(new Rect(20.0f, 20.0f, 100.0f, 20.0f), "Change scene")) + { + if (nextScene != null && nextScene.Length > 0) + Application.LoadLevel(nextScene); + else + Application.LoadLevel(Application.loadedLevelName); + } + } +} \ No newline at end of file diff --git a/Library/TextSceneBuildSettings.txt b/Library/TextSceneBuildSettings.txt index 9c80aca..df00171 100644 --- a/Library/TextSceneBuildSettings.txt +++ b/Library/TextSceneBuildSettings.txt @@ -1 +1,2 @@ scene Assets/Scenes/scenedemo.txt +scene Assets/Scenes/otherscenedemo.txt