Initialize
var access = new Access( "API_KEY", "GAME_ID", "USER_ID", "APP_VERSION", debugMode );
API_KEY:
Provided by us, from web app -> on the Team Page
GAME_ID:
Provided by us, from web app -> on the Game details Page
USER_ID:
A unique identifier for your user
APP_VERSION:
shown in results
debugMode:
true or false. On true we get Logging of actions in the
Theming
var theme = new Theme( new Theme.Dialog( Color.white, // [DIALOG] Background Color Color.black, // [QUESTION] question text color Color.black, // [SUBTITLE] subtitle text color Color.black, // [CLOSE_MODAL_ICON] Color of the Close button "Choose one to continue", // [SINGLE_CHOOSE_SUBTITLE] Choose one subtitle text "Choose one or more choices to continue", // [MULTI_CHOOSE_SUBTITLE] Multiple subtitle text "Fonts/Roboto-Light SDF", // [FONT_PATH] Font path for TextMeshPro saved on Scripts/PlaytestingGames/InAppSurvey/Resource/Fonts folder Theme.Dialog.Position.BOTTOM // or .CENTER ), new Theme.NextButton( HexToColor("#a8dab5"), // [NEXT_BUTTON] button background HexToColor("#FFFFFF"), // [NEXT_BUTTON] onClick button background HexToColor("#d9dadc"), // [NEXT_BUTTON] disabled button background Color.black, // [NEXT_BUTTON] disabled button.text Color.black, // [NEXT_BUTTON] text color Color.black // [NEXT_BUTTON] onCLick text color ), new Theme.Choice( HexToColor("#f2f3f3"), // [CHOICE] background HexToColor("#c8e4e4"), // [CHOICE] onClick background Color.black, // [CHOICE] text color Color.black // [CHOICE] onClick text color ), new Theme.Slider( Color.green, // [SLIDER] Fill Color HexToColor("#f2f3f3"), // [SLIDER] UnFilled Color Color.black, // SLIDER] Handle Background Color Color.white // [SLIDER] Handle text Color ) ); // Helper Function public static Color HexToColor(string hex) { // Remove the '#' character if present if (hex.StartsWith("#")) { hex = hex.Substring(1); } // Ensure the hex string is the correct length if (hex.Length != 6 && hex.Length != 8) { Debug.LogError("Invalid hex string length."); return Color.white; } // Parse the hex string byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); byte a = 255; // Default to fully opaque if (hex.Length == 8) { a = byte.Parse(hex.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); } // Convert the bytes to a Color object return new Color32(r, g, b, a); }
InAppSurvey.Initialize(access, theme, (bool success) => { if (success) onSuccess(); });
When initializing the package, provide a unique user ID that is meaningful to you (e.g., an analytics ID, a player ID, or any other identifier). This user ID will be associated with survey responses, enabling us to ensure that the same user does not receive the same survey multiple times.