diff --git a/client/Packages/com.beamable/Editor/LibraryService.cs b/client/Packages/com.beamable/Editor/LibraryService.cs index 4bce41669f..5ca408ba8a 100644 --- a/client/Packages/com.beamable/Editor/LibraryService.cs +++ b/client/Packages/com.beamable/Editor/LibraryService.cs @@ -36,7 +36,6 @@ public class LightbeamSampleInfo #region COMPUTED PROPERTIES - public LightbeamSampleType SampleType { get; set; } public Object ExistingPrefabInstance { get; set; } public Object PrefabObject { get; set; } public bool HasDocsUrl { get; set; } @@ -108,55 +107,28 @@ public void OpenDocumentation(LightbeamSampleInfo lb) public void OpenSample(LightbeamSampleInfo lb) { - var needsRefresh = false; try { AssetDatabase.DisallowAutoRefresh(); if (!lb.isLocal) { - needsRefresh = true; CopySampleIntoProject(lb); } } finally { AssetDatabase.AllowAutoRefresh(); - if (needsRefresh) - { - AssetDatabase.Refresh(); - } + AssetDatabase.Refresh(); // if the scene has changes, we don't want to just SWITCH. - - switch (lb.SampleType) + if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { - case LightbeamSampleType.SCENE: - if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) - { - EditorSceneManager.OpenScene(lb.localCandidateAssetPath, OpenSceneMode.Single); - EditorWindow.GetWindow(); - ShowInProject(lb); - - if (needsRefresh) - { - EditorUtility.RequestScriptReload(); - } - } + EditorSceneManager.OpenScene(lb.localCandidateAssetPath, OpenSceneMode.Single); + EditorWindow.GetWindow(); + ShowInProject(lb); + EditorUtility.RequestScriptReload(); - break; - case LightbeamSampleType.PREFAB: - if (lb.ExistingPrefabInstance == null) - { - GameObject existing = AssetDatabase.LoadAssetAtPath(lb.localCandidateAssetPath); - lb.PrefabObject = existing; - lb.ExistingPrefabInstance = PrefabUtility.InstantiatePrefab(lb.PrefabObject); - } - EditorGUIUtility.PingObject(lb.ExistingPrefabInstance); - - break; } - - } } @@ -282,27 +254,6 @@ void ResetSamples() lightbeam.localCandidateFolderMetafile = lightbeam.localCandidateFolder + ".meta"; lightbeam.HasDocsUrl = !string.IsNullOrEmpty(lightbeam.docsUrl); - - if (lightbeam.relativeMainAssetPath.EndsWith(".unity")) - { - lightbeam.SampleType = LightbeamSampleType.SCENE; - } else if (lightbeam.relativeMainAssetPath.EndsWith(".prefab")) - { - lightbeam.SampleType = LightbeamSampleType.PREFAB; - - if (lightbeam.isLocal) - { - GameObject existing = AssetDatabase.LoadAssetAtPath(lightbeam.localCandidateAssetPath); - lightbeam.PrefabObject = existing; - lightbeam.ExistingPrefabInstance = - PrefabUtility.FindAllInstancesOfPrefab(existing)?.FirstOrDefault(); - - } - } - else - { - Debug.LogError($"Unknown sample type. name=[{lightbeam.name}] assetPath=[{lightbeam.relativeMainAssetPath}]"); - } lightbeams.Add(lightbeam); } diff --git a/client/Packages/com.beamable/Editor/UI/LibraryWindow/BeamLibraryWindow_Samples.cs b/client/Packages/com.beamable/Editor/UI/LibraryWindow/BeamLibraryWindow_Samples.cs index 3a6696148f..0c57296d62 100644 --- a/client/Packages/com.beamable/Editor/UI/LibraryWindow/BeamLibraryWindow_Samples.cs +++ b/client/Packages/com.beamable/Editor/UI/LibraryWindow/BeamLibraryWindow_Samples.cs @@ -266,21 +266,8 @@ void DrawSample(Rect bounds, LightbeamSampleInfo lightBeam) { // draw button string text = ""; - if (lightBeam.SampleType == LightbeamSampleType.SCENE) - { - text = lightBeam.isLocal ? "Open Scene" : "Add Scene"; - } else if (lightBeam.SampleType == LightbeamSampleType.PREFAB) - { - // if the prefab is already in the current scene; then the button should say, "Show Prefab" - if (lightBeam.ExistingPrefabInstance == null) - { - text = "Add Prefab"; - } - else - { - text = "Select Prefab"; - } - } + text = lightBeam.isLocal ? "Open Scene" : "Add Scene"; + // var text = "Open Sample"; // if (!lightBeam.isLocal) // {