HI everyone , i want to encrypt my asset files to prevent leak and ... i cant found any solution . just saying do encrypt or xor and .... but how to do theme ?! i think a good way is encrypt the obb files , but i do not know how to do that by obb file and then decrypt it can some one help me to do that? (my game and goal is android devices) appreciate any help , thx
What exactly do you expect from this? People who wanna get your assets, will get them. Your property is already protected by licenses, copyright and whatnot. Encrypting and decrypting will take time, which increases loading times or decreases performance at runtime - either way decreases enjoyment of your game. Only a fraction of users on mobile devices can even access the file system to begin with. Ask yourself doubly whether this step is really necessary to you. The same is basically Unitys stance on the topic, but you may still find some of this useful: https://docs.unity3d.com/550/Documentation/Manual/protectingcontent.html
You can't. It is like trying to make water not be wet. The reason: the user's computer MUST be able to read it, so the keys must be present. All they have to do is breakpoint your program on a jailbroken device and read your keys, then use your own code to decrypt it and all your data can be read. Focus on what you CAN control: the quality of your game and whether you finish it. Forget about encryption.
thank you guys you are right @Yoreki @Kurt-Dekker , but did your ever seen the call of duty mobile , gomeloft games and other games that some of them are famous other not all of them the obb files are encrypted , i want to know how to do that leak assets is not very important for me , encryption knowledge about obb files and assets is important for me . Anyone know anything about obb file encyption or any similar way please share it , i realy appreciate it thank your very much .
OBB files are a pure Android feature. Unity offers the option to split your apk into a main apk and a single obb file just for reducing the file size. Unity does not support to ender an encryption key when the obb file is created. Maybe they add an option some day but currently it doesn't. Apart from that you can of course create your own encrypted obb files which you have to load and mount manually through the android api. This is completely outside of the scope of Unity. How to create such files and how to load mount them in native Java can be found here on Stackoverflow. To encrypt / decrypt actual asset files in Unity you probably should use AssetBundles instead which you can encrypt and decrypt in C# however you like.