Search Unity

How to disable the filtering of emoji characters

Discussion in 'iOS and tvOS' started by Arsmarin, Apr 21, 2016.

  1. Arsmarin

    Arsmarin

    Joined:
    Apr 21, 2016
    Posts:
    1
    In Unity 5.3.4 p1 release notes I see this:
    iOS: Added a compile flag in the trampoline code in order to allow the user to disable the filtering of emoji characters.

    How exactly I can add this compile flag, and what is this flag?

    http://unity3d.com/unity/qa/patch-releases/5.3.4p1
     
  2. ryan_unity

    ryan_unity

    Unity Technologies

    Joined:
    Dec 28, 2014
    Posts:
    11
    hi :)

    In the generated Xcode project you can go into /Classes/UI/Keyboard.mm and change the define for FILTER_EMOJIS_IOS_KEYBOARD. Setting this flag to 0 will allow emoji symbols to be entered using the keyboard.
     
  3. alejobrainz

    alejobrainz

    Joined:
    Sep 10, 2005
    Posts:
    288
    Hi Ryan, Do you know if there a way to do this via the Xcode Manipulation API in a Post process?
     
  4. ryan_unity

    ryan_unity

    Unity Technologies

    Joined:
    Dec 28, 2014
    Posts:
    11
    Hey,

    You can try defining a preprocessor symbol for the Xcode project, similar to what is described here: http://stackoverflow.com/questions/367368/how-to-define-a-preprocessor-symbol-in-xcode

    A script like the following should work:

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditor.Callbacks;
    3. using System.Collections;
    4. using UnityEditor.iOS.Xcode;
    5. using System.IO;
    6.  
    7. public class XcodePostProcessSteps {
    8.  
    9.  
    10.     // A post process step to modify the generated Xcode project, disabling the emoji filter
    11.     [PostProcessBuild]
    12.     public static void DisableEmojiFilter(BuildTarget buildTarget, string pathToBuiltProject) {
    13.  
    14.         // Only continue if we're building for iOS
    15.         if (buildTarget == BuildTarget.iOS) {
    16.  
    17.             // Get Xcode project
    18.             string pbxprojPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
    19.             PBXProject proj = new PBXProject();
    20.             proj.ReadFromString(File.ReadAllText(pbxprojPath));
    21.  
    22.             // Set GCC_PREPROCESSOR_DEFINITIONS to define FILTER_EMOJIS_IOS_KEYBOARD=0
    23.             string target = proj.TargetGuidByName("Unity-iPhone");
    24.             proj.SetBuildProperty(target, "GCC_PREPROCESSOR_DEFINITIONS", "FILTER_EMOJIS_IOS_KEYBOARD=0");
    25.  
    26.             // Write changes to the Xcode project
    27.             File.WriteAllText(pbxprojPath, proj.WriteToString());
    28.  
    29.         }
    30.     }
    31. }
    I hope this helps! :)
     
  5. alejobrainz

    alejobrainz

    Joined:
    Sep 10, 2005
    Posts:
    288
    Thank you so much!! Will give it a shot.
     
  6. JVLVince

    JVLVince

    Joined:
    Jul 20, 2016
    Posts:
    29
    Hi every one,
    sorry for popup this old post. Now I"m facing a similar problem, we have the same emoji problem but what we want is disable user to input it from input field. On iOS device we did already but on the android side, we have no idea to deal with it. Please guide me, any help will be appreciate :((
    Thanks, Vince
     
  7. steffanPL

    steffanPL

    Joined:
    Oct 9, 2014
    Posts:
    40
    Any update on that? How to disable the emoji keyboard on android?