浏览代码

Remote config integrated

Integrated the remote config package to remotely set up the character's hats
/remote-config-test
Arturo Nereu 3 年前
当前提交
e161c5df
共有 13 个文件被更改,包括 136 次插入12 次删除
  1. 37
      Assets/Scripts/PlayerConfigurator.cs
  2. 3
      Packages/manifest.json
  3. 28
      Packages/packages-lock.json
  4. 17
      ProjectSettings/ProjectSettings.asset
  5. 5
      ProjectSettings/UnityConnectSettings.asset
  6. 8
      Assets/Editor.meta
  7. 8
      Assets/Editor/RemoteConfig.meta
  8. 8
      Assets/Editor/RemoteConfig/Data.meta
  9. 26
      Assets/Editor/RemoteConfig/Data/RemoteConfigDataStoreAsset.asset
  10. 8
      Assets/Editor/RemoteConfig/Data/RemoteConfigDataStoreAsset.asset.meta

37
Assets/Scripts/PlayerConfigurator.cs


using UnityEngine;
using Unity.RemoteConfig; // We need this namespace for remotely configuring our selected hat
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

private AsyncOperationHandle m_HatLoadingHandle;
public struct userAttributes
{
// Optionally declare variables for any custom user attributes:
public bool expansionFlag;
}
public struct appAttributes
{
// Optionally declare variables for any custom app attributes:
public int level;
public int score;
public string appVersion;
}
ConfigManager.FetchCompleted += ApplyRemoteSettings;
ConfigManager.SetEnvironmentID("5bd6cbe9-1b79-4a51-b22b-59f547eaaf1a");
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
if(m_GameManager.s_ActiveHat >= 0)
{
SetHat(string.Format("Hat{0:00}", m_GameManager.s_ActiveHat));
}
//if(m_GameManager.s_ActiveHat >= 0)
//{
// SetHat(string.Format("Hat{0:00}", m_GameManager.s_ActiveHat));
//}
}
// TODO: Change the string parameter

m_HatLoadingHandle = Addressables.InstantiateAsync(hatKey, m_HatAnchor, false);
m_HatLoadingHandle.Completed += OnHatInstantiated;
}
void ApplyRemoteSettings(ConfigResponse configResponse)
{
m_GameManager.s_ActiveHat = ConfigManager.appConfig.GetInt("Selected_Hat");
SetHat(string.Format("Hat{0:00}", m_GameManager.s_ActiveHat));
}
private void OnHatInstantiated(AsyncOperationHandle obj)

3
Packages/manifest.json


"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.addressables": "1.16.19",
"com.unity.ide.visualstudio": "2.0.9",
"com.unity.ide.visualstudio": "2.0.11",
"com.unity.remote-config": "2.0.1",
"com.unity.render-pipelines.universal": "11.0.0",
"com.unity.scriptablebuildpipeline": "1.16.1",
"com.unity.textmeshpro": "3.0.6",

28
Packages/packages-lock.json


"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.9",
"version": "2.0.11",
"depth": 0,
"source": "registry",
"dependencies": {

"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "2.0.0",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.remote-config": {
"version": "2.0.1",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.nuget.newtonsoft-json": "2.0.0",
"com.unity.remote-config-runtime": "1.0.1"
},
"url": "https://packages.unity.com"
},
"com.unity.remote-config-runtime": {
"version": "1.0.1",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.nuget.newtonsoft-json": "2.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.render-pipelines.core": {

17
ProjectSettings/ProjectSettings.asset


useOnDemandResources: 0
accelerometerFrequency: 60
companyName: Unity Technologies
productName: Loady Dungeons
productName: Loady Dungeons Demo
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}

vulkanEnableSetSRGBWrite: 0
vulkanEnablePreTransform: 0
vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1
m_SupportedAspectRatios:
4:3: 0
5:4: 0

switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchUseGOLDLinker: 0
switchLTOSetting: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
switchTitleNames_0:

ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4AllowPS5Detection: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []

suppressCommonWarnings: 1
allowUnsafeCode: 0
useDeterministicCompilation: 1
useReferenceAssemblies: 1
enableRoslynAnalyzers: 1
additionalIl2CppArgs:
scriptingRuntimeVersion: 1

XboxOneOverrideIdentityPublisher:
vrEditorSettings: {}
cloudServicesEnabled:
Analytics: 1
Build: 0
Collab: 0
Game Performance: 0
Purchasing: 0
UDP: 0
Unity Ads: 0
luminIcon:
m_Name:
m_ModelFolderPath:

m_VersionName:
apiCompatibilityLevel: 6
activeInputHandler: 0
cloudProjectId: ceded976-9f8b-45f6-9555-266c5abf1251
cloudProjectId: 0202ccd8-4b57-4a91-bc6c-0693895d42f2
projectName: Loady Dungeons
projectName: Loady Dungeons Demo
organizationId: unity-evangelists
cloudEnabled: 0
legacyClampBlendShapeWeights: 0

5
ProjectSettings/UnityConnectSettings.asset


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_Enabled: 1
m_Enabled: 0
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:

m_Enabled: 0
m_Enabled: 1
m_TestMode: 0
m_InitializeOnStartup: 1
UnityAdsSettings:

8
Assets/Editor.meta


fileFormatVersion: 2
guid: 666b00cded37033409aee8626a222d18
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Editor/RemoteConfig.meta


fileFormatVersion: 2
guid: 7472c3318c49e1c4f83931ada73d43bf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Editor/RemoteConfig/Data.meta


fileFormatVersion: 2
guid: 516bb33bab57235449b1db260f177bae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

26
Assets/Editor/RemoteConfig/Data/RemoteConfigDataStoreAsset.asset


%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: 469c24fdb3bd6431b92cc1465bd9166b, type: 3}
m_Name: RemoteConfigDataStoreAsset
m_EditorClassIdentifier:
_rsKeyList: "[\r\n {\r\n \"metadata\": {\r\n \"entityId\": \"1963ea04-11e1-42f2-a465-719abb178dcc\"\r\n
},\r\n \"rs\": {\r\n \"key\": \"Selected_Hat\",\r\n \"type\": \"int\",\r\n
\"value\": 2\r\n }\r\n }\r\n]"
_rsLastCachedKeyList: "[\r\n {\r\n \"metadata\": {\r\n \"entityId\": \"1963ea04-11e1-42f2-a465-719abb178dcc\"\r\n
},\r\n \"rs\": {\r\n \"key\": \"Selected_Hat\",\r\n \"type\": \"int\",\r\n
\"value\": 2\r\n }\r\n }\r\n]"
_environments: "[\r\n {\r\n \"projectId\": \"0202ccd8-4b57-4a91-bc6c-0693895d42f2\",\r\n
\"name\": \"Production\",\r\n \"id\": \"5bd6cbe9-1b79-4a51-b22b-59f547eaaf1a\",\r\n
\"createdAt\": \"2021-07-28T17:54:40Z\",\r\n \"updatedAt\": \"2021-07-28T17:54:40Z\",\r\n
\"isDefault\": true\r\n }\r\n]"
_rulesList: '[]'
_lastCachedRulesList: '[]'

8
Assets/Editor/RemoteConfig/Data/RemoteConfigDataStoreAsset.asset.meta


fileFormatVersion: 2
guid: 73b60ccc92834b8409274bc8ce0af3fd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存