Skip to content

Commit

Permalink
Fixed demo crash issues
Browse files Browse the repository at this point in the history
Added WebGL demo into the project and a link to the Readme file
  • Loading branch information
CoderGamester committed Nov 18, 2024
1 parent 6987e3e commit 756b29d
Show file tree
Hide file tree
Showing 27 changed files with 285 additions and 11 deletions.
34 changes: 34 additions & 0 deletions Assets/AddressableAssetsData/ProfileDataSourceSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e3976da977cb49238499ea3b4c237ae, type: 3}
m_Name: ProfileDataSourceSettings
m_EditorClassIdentifier:
profileGroupTypes:
- m_GroupTypePrefix: Built-In
m_Variables:
- m_Suffix: BuildPath
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
- m_Suffix: LoadPath
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
- m_GroupTypePrefix: Editor Hosted
m_Variables:
- m_Suffix: BuildPath
m_Value: ServerData/[BuildTarget]
- m_Suffix: LoadPath
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
environments: []
currentEnvironment:
id:
projectId:
projectGenesisId:
name:
isDefault: 0

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/AddressableAssetsData/WebGL.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Addressables/Prefabs/UI/GameOver.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &8040406546790943630
RectTransform:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Addressables/Prefabs/UI/Main Menu.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &2484784257732393607
RectTransform:
m_ObjectHideFlags: 0
Expand Down
11 changes: 11 additions & 0 deletions Assets/Src/Services/GameUiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public interface IGameUiService : IUiService
/// value defined by the given <paramref name="loadingCap"/>
/// </summary>
UniTask LoadGameUiSet(UiSetId uiSetId, float loadingCap);

/// <summary>
/// Unloads all the <see cref="UiPresenter"/> defined by the given <paramref name="uiSetId"/>
/// </summary>
void UnloadGameUiSet(UiSetId uiSetId);
}

/// <inheritdoc cref="IGameUiService"/>
Expand Down Expand Up @@ -51,5 +56,11 @@ public async UniTask LoadGameUiSet(UiSetId uiSetId, float loadingCap)

loadingScreen.SetLoadingPercentage(loadingCap);
}

/// <inheritdoc />
public void UnloadGameUiSet(UiSetId uiSetId)
{
UnloadUiSet((int) uiSetId);
}
}
}
3 changes: 2 additions & 1 deletion Assets/Src/StateMachines/GameplayState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,13 @@ private async UniTask LoadGameplayAssets()
await UniTask.WhenAll(
_uiService.LoadGameUiSet(UiSetId.GameplayUi, 0.8f),
_services.AssetResolverService.LoadSceneAsync(SceneId.Game, LoadSceneMode.Additive));
await Resources.UnloadUnusedAssets().ToUniTask();
}

private void UnloadAssets()
{
_uiService.UnloadGameUiSet(UiSetId.GameplayUi);
_services.AssetResolverService.UnloadSceneAsync(SceneId.Game).Forget();
Resources.UnloadUnusedAssets();
}
}
}
5 changes: 3 additions & 2 deletions Assets/Src/StateMachines/MainMenuState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void UnsubscribeEvents()

private void OpenMainScreenUi()
{
_ = _uiService.OpenUiAsync<MainMenuPresenter>();
_uiService.OpenUiAsync<MainMenuPresenter>().Forget();
}

private void CloseMainScreenUi()
Expand All @@ -89,12 +89,13 @@ private async UniTask LoadMenuAssets()
await UniTask.WhenAll(
_uiService.LoadGameUiSet(UiSetId.MenuUi, 0.8f),
_services.AssetResolverService.LoadSceneAsync(SceneId.Menu, LoadSceneMode.Additive));
await Resources.UnloadUnusedAssets().ToUniTask();
}

private void UnloadAssets()
{
_uiService.UnloadGameUiSet(UiSetId.MenuUi);
_services.AssetResolverService.UnloadSceneAsync(SceneId.Menu).Forget();
Resources.UnloadUnusedAssets();
}
}
}
12 changes: 8 additions & 4 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PlayerSettings:
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
companyName: GameLovers
productName: Core-Game
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
Expand Down Expand Up @@ -84,6 +84,7 @@ PlayerSettings:
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
audioSpatialExperience: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
Expand Down Expand Up @@ -140,7 +141,8 @@ PlayerSettings:
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 1.0
preloadedAssets: []
preloadedAssets:
- {fileID: 11400000, guid: c3452a039b34041249d840c527f7b803, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
Expand Down Expand Up @@ -233,6 +235,7 @@ PlayerSettings:
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
metalAPIValidation: 1
metalCompileShaderBinary: 0
iOSRenderExtraFrameOnPause: 0
iosCopyPluginsCodeInsteadOfSymlink: 0
appleDeveloperTeamID:
Expand Down Expand Up @@ -746,11 +749,11 @@ PlayerSettings:
webGLTemplate: APPLICATION:Default
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 0
webGLCompressionFormat: 2
webGLWasmArithmeticExceptions: 0
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
webGLDecompressionFallback: 1
webGLInitialMemorySize: 32
webGLMaximumMemorySize: 2048
webGLMemoryGrowthMode: 2
Expand Down Expand Up @@ -812,6 +815,7 @@ PlayerSettings:
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
a: 1}
metroSplashScreenUseBackgroundColor: 0
syncCapabilities: 0
platformCapabilities: {}
metroTargetDeviceFamilies: {}
metroFTAName:
Expand Down
13 changes: 13 additions & 0 deletions ProjectSettings/ScriptableBuildPipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"useBuildCacheServer": false,
"cacheServerHost": "",
"cacheServerPort": 8126,
"threadedArchiving": true,
"logCacheMiss": false,
"slimWriteResults": true,
"maximumCacheSize": 20,
"useDetailedBuildLog": false,
"useV2Hasher": true,
"fileIDHashSeed": 0,
"prefabPackedHeaderSize": 2
}
4 changes: 3 additions & 1 deletion ProjectSettings/UnityConnectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
UnityConnectSettings:
m_ObjectHideFlags: 0
serializedVersion: 1
m_Enabled: 0
m_Enabled: 1
m_TestMode: 0
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
m_DashboardUrl: https://dashboard.unity3d.com
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com
Expand All @@ -22,6 +23,7 @@ UnityConnectSettings:
m_Enabled: 0
m_TestMode: 0
m_InitializeOnStartup: 1
m_PackageRequiringCoreStatsPresent: 1
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ This project is a the core foundation of a new game project.
- Open the UiConfigs scriptable object. Search in the project or Tools > Select UiConfigs.asset
- Open the "Boot" Scene to play the game demo

## Project Keybind Shortcuts
## Unity Project Keybind Shortcuts

- ALT+R to force compile all project code
- ALT+1 to open the "Boot" scene
- ALT+2 to open the "Main" scene

### Demo URL

https://codergamester.github.io/Core-Game/WebGL_Build/
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/MemoryProfiler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WebGL_Build/TemplateData/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/fullscreen-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/progress-bar-empty-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/progress-bar-empty-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/progress-bar-full-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/progress-bar-full-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions WebGL_Build/TemplateData/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
body { padding: 0; margin: 0 }
#unity-container { position: absolute }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
#unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100%; height: 100% }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-footer { position: relative }
.unity-mobile #unity-footer { display: none }
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
#unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/unity-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/unity-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/webgl-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions WebGL_Build/TemplateData/webmemd-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 756b29d

Please sign in to comment.