Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Anti-Cheat Toolkit: stop cheaters easily!

Discussion in 'Assets and Asset Store' started by codestage, Aug 20, 2013.

  1. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I was struggling with an issue with unity preprocessor and investigating deeply in the whole solution I found this in your files:

    Code (CSharp):
    1. #define DEBUG
    2. #undef DEBUG
    Unfortunately I was also using the DEBUG preprocessor and then I started to have issues.
    Would not be better to use a prefix for your defines, something like:
    ACT_DEBUG, ACT_DEBUG_VERBOSE, ACT_DEBUG_PRANOID

    I have the same issue with another plugin that is forcing defining DEBUG when in the editor... going to ask the same thing there too :)
     
    codestage likes this.
  2. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @mcmorry Ah, sure, I'll rename them in next update, thanks for the heads up!
     
    mcmorry likes this.
  3. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi @Dmitriy Yukhanov ,
    I just implement ACTK to protect player's gold.
    Code (CSharp):
    1. ObscuredInt gold;
    Unfortunatelly JSON.NET can't deserialize/convert it from Int in previous version saved data. How to fix it? Thanks.
     
  4. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi @zhuchun ,
    I resolved using a json converter.
    here is my code (it supports only the obscured type that I use, but you can add more):
    Code (CSharp):
    1.     public class ObscuredValueConverter : JsonConverter {
    2.  
    3.         private readonly Type[] _types = {
    4.             typeof(ObscuredInt),
    5.             typeof(ObscuredFloat),
    6.             typeof(ObscuredDouble),
    7.             typeof(ObscuredDecimal),
    8.             typeof(ObscuredChar),
    9.             typeof(ObscuredByte),
    10.             typeof(ObscuredBool),
    11.             typeof(ObscuredLong),
    12.             typeof(ObscuredQuaternion),
    13.             typeof(ObscuredSByte),
    14.             typeof(ObscuredShort),
    15.             typeof(ObscuredUInt),
    16.             typeof(ObscuredULong),
    17.             typeof(ObscuredUShort),
    18.             typeof(ObscuredVector2),
    19.             typeof(ObscuredVector3),
    20.             typeof(ObscuredString)
    21.         };
    22.  
    23.         #region implemented abstract members of JsonConverter
    24.  
    25.         public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) {
    26.             if (value is ObscuredInt) {
    27.                 writer.WriteValue((int)(ObscuredInt)value);
    28.             } else if (value is ObscuredBool) {
    29.                 writer.WriteValue((bool)(ObscuredBool)value);
    30.             } else if (value is ObscuredFloat) {
    31.                 writer.WriteValue((float)(ObscuredFloat)value);
    32.             } else {
    33.                 Debug.Log("ObscuredValueConverter type " + value.GetType().ToString() + " not implemented");
    34.                 writer.WriteValue(value.ToString());
    35.             }
    36.         }
    37.  
    38.         public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {
    39.             if (reader.Value != null) {
    40.                 if (objectType == typeof(ObscuredInt)) {
    41.                     ObscuredInt value = Convert.ToInt32(reader.Value);
    42.                     return value;
    43.                 } else if (objectType == typeof(ObscuredBool)) {
    44.                     ObscuredBool value = Convert.ToBoolean(reader.Value);
    45.                     return value;
    46.                 } else if (objectType == typeof(ObscuredFloat)) {
    47.                     ObscuredFloat value = Convert.ToSingle(reader.Value);
    48.                     return value;
    49.                 } else {
    50.                     Debug.LogError("Code not implemented yet!");
    51.                 }
    52.             }
    53.             return null;
    54.         }
    55.  
    56.         public override bool CanConvert(Type objectType) {
    57.             return _types.Any(t => t == objectType);
    58.         }
    59.  
    60.         #endregion
    61.    }
    62.  
    EDIT: I removed Vector2 from the code as I had problems with it. It didn't work.
    JSON.NET is not able to serialize/deserialze Vector2 types by itself so I tried to use also a Vector2 converter but it seems that is not possible to stack multiple converters for the same type. So to serialize a ObscuredVector2 the first converter goes from ObscuredVector2 to Vector2, and then the second converter from Vector2 to a simpler struct with two floats. To make it works you should already convert inside the ObscuredValueConverter to a custom struct.
     
    Last edited: May 20, 2016
  5. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Appreciate! Your script works great! Thanks for sharing.
    ---------------------------------------------
    Tips for others:
    1. If you're not familiar with namespaces, here there are
    Code (CSharp):
    1. using UnityEngine;
    2. using System;
    3. using System.Linq;
    4. using Newtonsoft.Json;
    5. using CodeStage.AntiCheat.ObscuredTypes;
    2. Make sure you use both of them! Otherwise you may save/load(missing serialize/deserialize) empty objects to your fields.
    Code (CSharp):
    1. //Usage
    2.  
    3. //Serialize
    4. string json = JsonConvert.SerializeObject(myObject, Formatting.None, new ObscuredValueConverter());
    5.  
    6. //Deserialize
    7. var myObject = JsonConvert.DeserializeObject<MyClass>(json, new ObscuredValueConverter());


    3. This script include reflectoin such as typeof, if I remember it correctly and you're using stripping level for mscorlib, be careful :). EDIT: It's fine.

    4. Just like @mcmorry said, NOT all types are implemented. Feel free to fill those missing parts of _types into WriteJson() and ReadJson() if you need. Otherwise I suggest comment out those unimplemented types in _types manually.
     
    Last edited: May 21, 2016
  6. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @zhuchun

    Looks like your question already solved by @mcmorry %)
    Anyways, I'd suggest to use converters too, it's a most proper way to go.

    Regarding typeof and Types - it should work perfectly fine with micro mscorlib.
    Please let me know if you still have any further questions!

    Hey, @mcmorry

    Huge thanks for sharing your experience and working solution, really appreciate it!
     
    leejinmyoung, zhuchun and mcmorry like this.
  7. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
  8. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Fattie!

    ObscuredPrefs lock to device feature depends on READ_PHONE_STATE permission.
    If you don't use ObscuredPrefs lock to device, you may easily get rid of the READ_PHONE_STATE by using
    ACTK_PREVENT_READ_PHONE_STATE conditional compilation flag.

    See readme's troubleshooting section for more details on this.
     
  9. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    Hi Dimitriy, great news

    "How can I remove READ_PHONE_STATE permission requirement on Android?If you don’t use ObscuredPrefs.lockToDevice feature and building an android application, I’d suggest to add the ACTK_PREVENT_READ_PHONE_STATE conditional compilation symbol to the Scripting Define Symbols in the Player Settings (as described in the docs) to remove READ_PHONE_STATE permission requirement on Android. Otherwise, you’ll need this requirement to let ACTk lock your saves to the device."

    In short, I do not need to do ANYTHING other than include the ACTK_PREVENT_READ_PHONE_STATE symbol ...

    I don't need to change any for example Manifest files, or anything else at all?

    Thanks!!
     
  10. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Yes, just add that conditional compilation symbol and you should be fine :)
     
  11. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    With the last version I tried to move the whole folder of ACT into Plugins folder, (as I have all external plugins there and should speedup compilation (or at least it was like this until few versions ago of Unity.. now it compiles everything every time... :( )) but in some ObscuredPrefs methods were not accessible from ActPrefsEditor because of the internal visibility. Changing them to public resolved the issue. Is it really needed to have them internal? Does it improve security in any way?

    Also another thing. One of the key in my playerprefs is too long and generate the exception of "String too long for TextMeshGenerator. Cutting off characters."
    It is a huge json containing the localization in multiple languages (not the best I see, but this is the way I2 Localization plugin works).
    Could be enough to disable the input and show inside "String too long", without raising the exception.
     
  12. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @mcmorry

    Thanks for your comments.
    Regarding internals - this will be fixed in next update, your current fix is fine.
    I prefer to avoid making stuff public if it is something made only for internal usage and not documented.

    Regarding huge string - ObscuredPrefs internally relies on the PlayerPrefs, and currently I'm not sure about specific string length restrictions. Prefs may have size restrictions on different platforms, and string length restrictions may differ on different platforms too, so it might be not trivial to take these into account.

    The general suggestion here - try to avoid storing huge data in prefs and use regular files for that. You still may store stuff encrypted using Obscured types static Encrypt/Decrypt methods, keeping your data safe from curious people.
     
  13. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    The issue is not about length restriction on player pref, but about the editor UI that can't render a text that is to long... strange enough, the editor UI is rendered as a game using triangles! So the text is rendered by quads of 4 vertices. One for each letter. The limit for a mesh is of 65535 vertices, that means 16.383 characters.
    The exception is coming then just because you are rendering a very long text in the UI.
    This is why I was suggesting to add a check to skip the rendering and disabling the input field (with a message inside "String too long").
     
    codestage likes this.
  14. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Ah, I misunderstood you initially, sure, I'll add an extra check for that, thanks for your great suggestion!
     
    mcmorry likes this.
  15. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Dmitriy Yukhanov One more thing. I see this in the prefs editor:
    Screenshot 2016-06-06 13.22.19.jpg
    Do you have any idea what could be?
    Instead of Float, Int or String I have "61"?! :)
    Plus there is no key...
    I'm planning to delete it but maybe we can investigate more if you need it.
    Also if I try to copy to clipboard I get this when I past it in a text editor:
    Key:
    Value: Not editable value
     
  16. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Oh, this looks like some corrupted pref, but I'm not sure..
    Would be nice to see the raw values (http://i.imgur.com/kKdMDZR.png) or the key itself in the registry \ plist if possible.

    Thanks!
     
  17. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I used another player pref editor and seems to be one key that is not listed with your editor. It's a standard string value.
    I though it could be because of the exception on the rendering of the long text, but I changed your code as this:
    Code (CSharp):
    1. if ((record.prefType == PrefsRecord.PrefsType.String && !record.Obscured) || (record.Obscured && record.obscuredType == ObscuredPrefs.DataType.String))
    2.                 {
    3.                     if (record.StringValue.Length > 16383) {
    4.                         GUI.enabled = false;
    5.                         EditorGUILayout.TextField("String too long", GUILayout.MinWidth(150));
    6.                     } else {
    7.                         record.StringValue = EditorGUILayout.TextField(record.StringValue, GUILayout.MinWidth(150));
    8.                     }
    9.                 }
    but I still have the missing key.
     
    codestage likes this.
  18. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Copy unobscured didn't update the clipboard.
    I checked in the plist file on mac and seems fine. I'll p.m. my file so you can check.
     
  19. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Thanks, that will help alot!
     
  20. Ocean257

    Ocean257

    Joined:
    Jan 9, 2016
    Posts:
    16
    hello Dmitriy sir,
    in this function
    1 ) static void SetNewCryptoKey (int newKey)
    what is the use of newKey ?
    2 ) static int Encrypt (int value, int key)
    what is the difference between cryptokey and encrypt key
    please tell me a quick tutorial i am totally confused
    what will happen if i not use SetNewCryptoKey functionns and Encrypt function in my ObscuredInt ?
    I am new to Security and totally confused please help me
     
  21. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Ocean257 !

    SetNewCryptoKey sets the new default key used for any new instances of the obscured type.
    Encrypt allows you to quickly encrypt data, without making any new obscured instances.

    Use SetNewCryptoKey once, to change the default key of the obscured type.
    Use Encrypt each time you wish to encrypt any data of the specified type. E.g. for saving for later decryption or sending over network, etc.

    Please let me know if you still confused and have any further questions. I'd be glad to help as much as I can!
     
  22. Ocean257

    Ocean257

    Joined:
    Jan 9, 2016
    Posts:
    16
    what is default key ?what is the use of it ?
    what does default key does ?

    suppose i have 5 variable of type int I don't want to send any one of them to any network or i don,t want to save them should i encrypt it ? should i make the type int to ObscuredInt ? (these five variable are just targets that i need to complete every stages )
    if i use ObscuredInt .SetNewCryptoKey (key) what will happen in behind (please give me a short explanation)
    and if i use ObscuredInt .Encrypt (int,key); what will happen in behind
    what is the type of int in ObscuredInt .Encrypt (int,key); is it normal int or ObscuredInt
     
    Last edited: Jun 15, 2016
  23. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Obscured type uses default key while encrypting your regular type value.
    For example, look at this line:
    Code (CSharp):
    1. ObscuredInt safeInt = 10;
    10 will be encrypted with default key for the ObscuredInt under the hood.

    If those 5 values are sensitive and you wish to protect them from memory cheating - you may do this just by changing type to the ObscuredInt.

    It will just change default key for ObscuredInt. It will not affect any existing obscured instances. But new key will be used for any new instances and new encryption operations.

    It will encrypt some your int with specified key. If you will not specify key, current default key will be used.

    It's normal, regular int. As I mentioned earlier, these Encrypt \ Decrypt methods are utility kind, in case you wish to encrypt something for saving \ sending and later decryption.
     
    Ocean257 likes this.
  24. Ocean257

    Ocean257

    Joined:
    Jan 9, 2016
    Posts:
    16
    Thank you sir ,
    what is the advantage of changing the default key ?
     
  25. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    You're welcome!

    It's more secure, since default key is hardcoded and may be spotted in the code.
    So, it's a good idea to generate a new key or get it from somewhere from outside the application and use it instead.
     
    Ocean257 likes this.
  26. Ocean257

    Ocean257

    Joined:
    Jan 9, 2016
    Posts:
    16
    "somewere outside the application" what does that mean ?
     
  27. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    E.g. from your web server, over https and own encrypted protocol ;)
     
    Ocean257 likes this.
  28. stlouis4d

    stlouis4d

    Joined:
    Jul 19, 2015
    Posts:
    34
    I'm looking at purchasing Anti-Cheat Toolkit, but some of the wording in your product description ("PlayerPrefs replacement with automatic migration") and tutorials is a bit confusing. Particularly, "just replace regular PlayerPrefs with ObscuredPrefs in your code where you save sensitive data, that’s all (really)! Migration from PlayerPrefs to the ObscuredPrefs is fully automatic".

    What does "fully automatic" mean? To my understanding, the migration from PlayerPrefs to ObscuredPrefs is done for you (i.e. fully automatic), but the tutorials show you actually having to go into your code and MANUALLY replace all of the instances of PlayerPrefs with ObscuredPrefs (as well as all variables to Obscured variables (i.e. Int to ObscuredInt), etc.), but manually doing something would be the exact opposite of automatically doing something, but your statement in the paragraph above sounds like it's telling me to "manually" replace PlayerPrefs with ObscuredPrefs, but then states that the process (migration) is "fully automatic", which once again is contrary to each other.

    Can you clarify this so that I know what to expect when I purchase this product? I know that sometimes as products evolve and are updated the descriptions that get posted in various places on the Internet don't always get updated as well (i.e. your YouTube tutorials are dated as old as 2014 with version 1.3.4, but the product description on UAS is from June 2016 with version 1.5.1), so I just want to know what to expect your asset to do so that I can evaluate it fairly.

    Since the code in my current game is almost completed, will I have to go back through and manually replace all variable references to Obscured variables and all PlayerPrefs to ObscuredPrefs or is there an automatic process (find and replace function) built into your asset that will automatically replace these instances in my scripts? Of course I could manually go through my code to make these changes, but from the description of your asset of it being "fully automatic", I wouldn't expect to have to, so I'd like clarification of how your asset works before purchasing it.

    For reference, I'm using Mad Level Manager (on an Android & iOS mobile game) and looking to secure my saved game data since Mad Level Manager uses unsecured PlayerPrefs by default. Since it supports both Easy Save and Anti-Cheat Toolkit, I wanted to give both assets a fair consideration before purchasing one or the other; especially since they're both the same price. From what I've read in the product descriptions of each asset, Anti-Cheat Toolkit appears to do much more than Easy Save (i.e. intrusion detection and deterring), but since I'm primarily concerned with securely saving my data (which, unless I'm mistaken, in and of itself prevents most cheating), I'm looking for something that will secure my data without me having to re-code my game unless necessary. Additionally, Easy Save uses AES 128-bit encryption, but I've not read how securely Anti-Cheat Toolkit encrypts data. Can you list its encryption level as well?

    While I have to admit that Anti-Cheat Toolkit appears to be the choice I'm leaning towards, I'm hoping that the above requested clarification will help me to choose Anti-Cheat Toolkit over Easy Save for use with Mad Level Manager in my game.
     
  29. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @stlouis4d !

    Thanks for your interest in ACTk.

    Automatic migration - all your regular prefs saved with PlayerPrefs will be automatically encrypted and converted to the ObscuredPrefs.

    Of course, you still need to swap your PlayerPrefs calls to the ObscuredPrefs ones. It may be easily done with global search and replace (avoid touching ACTk classes though) or precisely replace them only for the sensitive keys you store in prefs.

    You don't need to manually replace all variable types to the obscured ones. But you more likely wish to do this for the sensitive variables, like ammo, lives, etc.

    Regarding "fully automatic" - it's from the ObscuredPrefs description, regarding automatic data migration I mentioned above, this is not something applicable to all obscured types.

    Yep, PlayerPrefs protection is only one of the things ACTk can offer. And you don't need to re-code any logic or something, all you need to do to leverage PlayerPrefs protection - just replace PlayerPrefs.* with ObscuredPrefs.* in places where you're working with sensitive data of you use PlayerPrefs directly.

    If you're working with prefs via MadLevelManager, it does all the job for you and you don't need to change anything in your code at all.

    ACTk uses fastest possible encryption based on the XOR operations. Just because there is absolutely no point in using anything stronger since all encryption is done on the client side and any client-side algorithm will be equivalently vulnerable to the hacker. So more stronger encryption will just make things slower or will use more CPU cycles for calculations thus using more battery power.

    I'm glad to hear you're leaning towards ACTk and I'll try to make things clearer for you to make a right choice after all.
    So if you still have any further questions - feel free to ask, and I'll try to help as much as I can.
     
  30. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey everyone!

    I'm glad to let you know new 1.5.2.0 update is available at the Asset Store!
    This update is mostly focused on bug fixes and improvements and has one important change in API - now callbacks for the InjectionDetector should have one string parameter, please make sure to update your code accordingly.

    Full changes list:
    1.5.2.0
    - InjectionDetector callbacks now should accept string with detection cause
    - improved Window > CodeStage > Anti-Cheat Toolkit menu appearance
    - added new Prefs Editor window mode: as an utility window (via new menu item)
    - renamed DEBUG conditional symbols to the ACTK_DEBUG to avoid collisions
    - added few more standard prefs to the Prefs Editor ignores
    - ObscuredFloat GC allocations on initialization removed (thx pachash)
    - ObscuredDecimal GC allocations on initialization removed (thx pachash)
    - added proper reaction in case obscured data can't be decrypted in Prefs Editor
    - fixed "E" button width when adding new pref
    - fixed wrong prefs readout in rare cases in Prefs Editor (thx mcmorry)
    - fixed "Cutting off characters" error by checking string length (thx mcmorry)
    - fixed errors if working from the Plugins folder in Unity 5.3+ (thx demigiant)
    - fixed pref deletion wasn't saved on Mac
     
  31. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    196
    Hi, I'm getting this error on Unity 5.3.5p5

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. CodeStage.AntiCheat.EditorCode.PropertyDrawers.ObscuredFloatDrawer.OnGUI (Rect position, UnityEditor.SerializedProperty prop, UnityEngine.GUIContent label) (at Assets/CodeStage/AntiCheatToolkit/Editor/Scripts/PropertyDrawers/ObscuredFloatDrawer.cs:43)
    3. UnityEditor.PropertyDrawer.OnGUISafe (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:23)
    4. UnityEditor.PropertyHandler.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:134)
    5. UnityEditor.EditorGUI.PropertyFieldInternal (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4919)
    6. UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property, Boolean includeChildren) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:963)
    7. UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:958)
    8. UnityEditor.Editor.OptimizedInspectorGUIImplementation (Rect contentRect) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:234)
    9. UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:33)
    10. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211)
    11. UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028)
    12. UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
    13. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    14.  
     
  32. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @milox88

    It's a known issue and already was fixed and sent for review on Store as a silent update, but wasn't approved yet.

    Check your PM inbox for a direct link to the updated package to avoid waiting for approval.
     
  33. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    196
    Seems to be working, thanks!
     
  34. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    I had a weird issue happen to me. After using the plugin successfully for months (years?) a few of my Editor-exposed floats oddly changed values and started triggering cheat detection!

    I had to go through the Hierarchy to find the values and re-edit them to fix the issue. This also happened when building to devices.

    Sorry, I don't have any more diagnostic information. Opening an old version of the project made the values change when the project loaded (resulting in the project becoming "Saveable", as there are changes).

    v1.5.1.0
     
  35. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @pea !

    Oh, that glitch again.. Some other customers rarely reported similar issue during last years, but no one could reproduce it and I couldn't find the source too.
    It may be some Unity serialization system issue, or some deep bug in my code which occasionally pops up and does this damage.

    I'll try to find it, but more likely I'll don't succeed again =\

    If it's still possible - I'd be glad to take a look at the prefabs with broken floats, it may help to figure out what happened.

    And if you'll encounter it again - would be super great to know what steps lead to this issue, to be able to reproduce it on my side.
     
  36. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hey @Dmitriy Yukhanov!

    I hope to reproduce it for you. The moment I had edited those two broken ObscuredFloat values it just mysteriously stopped happening (the new values 'stuck').

    The following probably doesn't really help, but just in case: I had a look if it was due to me calling SetNewCryptoKey on everything in Awake, but commenting that out made no difference. I closed my project a few times and re-opened and it would instantly jump to being "saveable", so meaning my old value was still in the saved project, but something changed those values each time the project was opened.
     
  37. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey again, @pea !

    Is it possible you're having some [ExecuteInEditMode] scripts which touch those ObscuredFloats somehow?
    And another question - does this happens on one game object, with all ObscuredFloats on it? Or it has only few "broken" ObscuredFloats and others on the same object are fine?

    This is pretty tricky issue and I still wasn't able to reproduce it anyhow, that's why I ask so much silly questions =D

    Also if it's possible, would be great to move to the PM, email or skype for further support discussion to avoid disturbing other subscribers of the forum if you're not against of course!
     
    pea likes this.
  38. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    im using 5.3.4p5 and when my obscured variable are shown in editor i got this error:

    NullReferenceException: Object reference not set to an instance of an object
    CodeStage.AntiCheat.EditorCode.PropertyDrawers.ObscuredFloatDrawer.OnGUI (Rect position, UnityEditor.SerializedProperty prop, UnityEngine.GUIContent label) (at Assets/Plugins/CodeStage/AntiCheatToolkit/Editor/Scripts/PropertyDrawers/ObscuredFloatDrawer.cs:43)
    UnityEditor.PropertyDrawer.OnGUISafe (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at /Users/builduser/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:23)
    UnityEditor.PropertyHandler.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) (at /Users/builduser/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:134)
    UnityEditor.EditorGUI.PropertyFieldInternal (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4919)
    UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property, Boolean includeChildren) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:963)
    UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:958)
    UnityEditor.Editor.OptimizedInspectorGUIImplementation (Rect contentRect) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:234)
    UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:33)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211)
    UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028)
    UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  39. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Damien Delmarle !

    It's the same known thing which was fixed already but not hit the store yet.
    Please check your PM for the fixed version.
     
  40. victor_sq

    victor_sq

    Joined:
    Feb 19, 2016
    Posts:
    36
    Dear Dmitriy Thank you for useful plugin, I'd like to know if this plugin can handle simple time change of phone by user? I have long span time periods for some power ups so after each usage time stored as obscured player prefs, (I can't relay on app being in background for so long time span) as I understood from readme speed hack doing this job but not sure in this case. I don't want use server time check non of competitors do in order to deliver better experience to player even offline.
     
  41. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Victor-SQF !

    Let me shamelessly copy-paste my answer on similar question:

     
  42. Kanos

    Kanos

    Joined:
    Jun 17, 2015
    Posts:
    15
    Hi Dmitriy,
    Since upgrading to the latest version (1.5.2.1) , I have had a problem with the prefs editor crashing Unity.
    It worked fine previously. It freezes when the window begins to display. You can see nothing in the window (its just white with the title "Prefs Editor". after a while unity stops working. I don't even get a crash log in unity. This happens whether I launch it as a utility or a tab
    The previous edition I was on was 1.5.1.0 - it worked fine.
    Any ideas?

    I should add that the code still works in my app, it's just the prefs editor that crashes.
     
  43. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Kanos !
    This is weird...
    Could you please provide your prefs ( via PM or email) end ObscuredPrefs key if you used ObscuredPrefs to let me investigate issue?

    Here is a quote from docs about prefs locations:

    Note: on Win you'll need to run regedit to look at the registry and whole key export is needed to provide prefs for investigation.

    Thanks!
     
  44. Kanos

    Kanos

    Joined:
    Jun 17, 2015
    Posts:
    15
    Hi Dmitriy,
    On exporting the key I realised that perhaps some of the entries had become corrupted.
    I deleted the key entries in the registry and as my game recreates a default set they worked out fine.
    This seems to have fixed it. Not sure how the keys got corrupted just by updating to the new version.
    My suspicion is that something else may have caused this problem.
    The important thing is that it works now so I am happy :).
     
    codestage likes this.
  45. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Yey! Glad it sorted out, thanks for letting me know!
     
  46. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Had a super-weird bug come up, I've not tried to reproduce this yet so just posting here for SEO incase others run into it.

    I was using Unity 5.3.6f1, upgraded to 5.4f3, then upgraded ACT from 1.5.0.6 to 1.5.2.1.

    My game uses a ScriptableObject (never again!) to store a bunch of static data, the bug was that in doing the upgrades all the ObscuredFloats and ObscuredDoubles in that ScriptableObject became super tiny values (3.235416E-40 for float, 1.04241428419107E-318 for the doubles)

    In the Unity editor the values were still showing as expected but when read in code it was pulling these tiny numbers from ... somewhere. Manually overwriting the numbers in the editor fixed the disconnect.
     
    Last edited: Jul 29, 2016
  47. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    Is there a reason why obscured short doesn't show in the inspector? I think i can implement the property drawer myself, but I would like to know if there is a deeper I should consider.
    Thanks
     
  48. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    After upgrading to ACT 1.5.2.1 from 1.5.1 I am getting false positives in memory cheating every single time. Can you provide me a 1.5.1 packgame please? I don't know if it was the upgrade process or what. This is the line which is causing the false positive:
    Code (csharp):
    1.  float variable= (float)genericList[i].obscuredFloatVariable;
    Sometimes it doesn't trigger in this line, but it triggers immediately after in this one:
    Code (csharp):
    1. float sum = (float)maxValueRange.minValue + (float)maxValueRange.luckyOffset;
    Any ideas? It was working before. I'll pm you.

    EDIT: Nevermind. I am reverting.
     
    Last edited: Jul 29, 2016
  49. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, @Aurigan !

    Thanks for reporting it, I'll investigate this case and will try to reproduce it.

    Hey, @guzzo !

    ObscuredShort just has no drawer, as no one asked for this before. I'll implement it in next update, thanks for your request!

    Regarding false positives - really sorry it happening =\
    It could happen because of internal changes in the obscured types in case you're using some custom serialization systems which do not take into account FormerlySerializedAs attribute I use.. Or something else my tests missed out.
    Are you storing your obscured variables on prefabs, or somehow else?
    Did you updated Unity between ACTk updates?
    Also would be great to take a repro case to let me take a look and debug it.

    Sent you 1.5.1 version by email.
     
  50. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    • I am storing the variables on prefabs.
    • No, I think I jumped between the version I had and the last one without upgrading in between.
    • Sorry, It would be hard to cut the project and I have already reverted to my last project version and i wouldn't like to upgrade and reproduce the issue again (don't have many time).
    Thanks for the support.