iOS デバイスの設定パネルを使用して設定を表示しようとしています。このトピックに関するこれらの情報源を読みました。
http://forum.unity3d.com/threads/23699-App-Settings http://answers.unity3d.com/questions/40506/ios-application-in-the-settings-panel.html
これは開発中のゲームではなく、アプリ内の設定は適切ではありません。この選択に疑問を呈したい場合は、単にアプリケーションの料金を支払っている人々が、それを固定の明示的な要件として挙げており、この要件を変更する気がないというだけです。
私が現在抱えている問題は、Settings.bundle が完成しているにもかかわらず、iOS デバイスで自分の設定を正しく受信できないことです。
ソースコードは以下にあります。紛らわしい部分は、「manual_session_control」と「ignore_screen_locks」が使用時に登録されていることです。
PlayerPrefs.HasKey(...);
ただし、.GetInt の .GetString() を呼び出すと、空の文字列または 0 が返されます。PlayerPrefs.GetBool() はありません。
また、PlayerPrefs.HasKey(...); を呼び出すと、他の値は false を返します。誰でもこの問題について明確に説明できますか。Unity 4.2.1 を使用しています。
設定リスト
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Title</key>
<string>Configurator</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>DefaultValue</key>
<string>127.0.0.1</string>
<key>IsSecure</key>
<false/>
<key>Key</key>
<string>server_ip</string>
<key>KeyboardType</key>
<string>URL</string>
<key>Title</key>
<string>Host Address</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Host Port</string>
<key>DefaultValue</key>
<string>4782</string>
<key>Key</key>
<string>server_port</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>KeyboardType</key>
<string>NumberPad</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Manual Session Control</string>
<key>Key</key>
<string>manual_session_control</string>
<key>DefaultValue</key>
<false/>
<key>TrueValue</key>
<string>true</string>
<key>FalseValue</key>
<string>false</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Theme</string>
<key>Key</key>
<string>theme</string>
<key>DefaultValue</key>
<string>Basic</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Debug</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Ignore Screen Locks</string>
<key>Key</key>
<string>ignore_screen_locks</string>
<key>DefaultValue</key>
<string></string>
<key>TrueValue</key>
<string>true</string>
<key>FalseValue</key>
<string>false</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Show Screen Log</string>
<key>Key</key>
<string>show_screen_log</string>
<key>DefaultValue</key>
<false/>
<key>TrueValue</key>
<string>true</string>
<key>FalseValue</key>
<string>false</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
ユニティコード
#elif UNITY_IPHONE
IP = PlayerPrefs.GetString("server_ip");
Port = PlayerPrefs.GetInt("server_port");
ManualSessionControl = PlayerPrefs.GetString("manual_session_control") == "true" ? true : false;
IgnoreScreenLock = PlayerPrefs.GetString("ignore_screen_locks") == "true" ? true : false;
Theme = PlayerPrefs.GetString("theme");