Skip to content

Commit e278671

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Warning pops up describing the issue, auto inserts the right part
1 parent a61dffa commit e278671

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Runtime/Editor/ProjectSettings.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,26 @@ private void DrawGameSettings()
9191
if (EditorGUI.EndChangeCheck())
9292
{
9393
gameSettings.domainKey = m_CustomSettings.FindProperty("domainKey").stringValue;
94+
95+
string domainkey = m_CustomSettings.FindProperty("domainKey").stringValue;
96+
97+
string pattern = @"(?<=https://)\w+(?=\.api\.lootlocker\.io/)";
98+
Regex regex = new Regex(pattern);
99+
Match match = regex.Match(domainkey);
100+
101+
if (match.Success)
102+
{
103+
string regexKey = match.Value;
104+
Debug.LogWarning("You accidentally used the domain url instead of the domain key,\nWe took the domain key from the url.: " + regexKey);
105+
gameSettings.domainKey = regexKey;
106+
m_CustomSettings.FindProperty("domainKey").stringValue = regexKey;
107+
}
108+
else
109+
{
110+
gameSettings.domainKey = domainkey;
111+
m_CustomSettings.FindProperty("domainKey").stringValue = domainkey;
112+
}
113+
94114
}
95115
var domainContent = new GUIContent();
96116
domainContent.text = "Domain key can be found in `Settings > API Keys` in the Web Console: https://console.lootlocker.com/settings/api-keys";

0 commit comments

Comments
 (0)