As we all know ,if the Unity game for android apk most can be reflected to get the Assembly-CSharp.dll source code. I hear someone say that Unity game for IOS after build had encrypted , if this is true, i have not to take more time to protect my game code . But if this is not realy, what can i do to protect my code on IOS and Android.
To cite the page from the unity manual about Asset protection (bundles)
[...]our general stance is that if users are determined to extract
your assets, they will be able to. - http://docs.unity3d.com/Manual/protectingcontent.html
The doc that Minzkraut cites in his answer is about protecting your 3D assets and textures. If you want to protect your code, an easy thing would be to use an objuscation software on your classes. I found one just by writing "obfuscation in unity" on google.
Now, it will make the job of reading your code way more difficult, but it will not encrypt your code so it is not 100% secure.
For most applications, I suppose that there would be no real need to encrypt your code anyway. As for other assets, if someone is truly determined to read your code, he will find a way
Related
I am developing a Chess Game in Unity. I am not writing the AI by myself but using the chess engine named MadChess.
I downloaded the source code of the engine(which is written in C#) as well as the executable file named "MadChess.exe"(which is basically a command prompt through which we can talk with the engine following UCI protocols)
I haven't actually integrated a chess engine with a unity project before and also not able to find many resources online on how to do it.
Approach 1:
Initially, I wrote a C# script in Unity which creates a separate process to communicate with "MadChess.exe" but I later realized that the approach is buggy. This is because when I build my Unity Project as a standalone application for Windows, it is dependent on the physical "MadChess.exe" file located on my PC i.e. it doesn't build everything(My Unity Project code along with the Chess Engine Code) together into a single executable application. This according to me is faulty and can only be rectified by creating an installer of the game which injects the "MadChess.exe" file along with my main Unity code.
Approach 2:
Now, I am trying to go through the source code of MadChess chess engine project and basically creating .dll files of the chess engine project which I plan to use as plugins in my Unity project. I would interface with them through my C# code in Unity eventually. Is it the correct way or not?
I am stuck at this for around a week or so and still not able to find a clear way. I don't want to spend another week just to realize that I am doing it wrong. Even if I am wrong from the start please let me know. I simply want to integrate a Chess Engine with my Unity Project. If someone has any suggestions or ideas or if someone has done this before please guide me. I would be grateful. Thanks for bearing with me till here.
I recommend using Approach 1
Both approaches sound valid, but I recommend using Approach 1 to communicate with MadChess.exe as a process, because this is much less work than Approach 2, especially if you already have the first approach working (aside from the build issue).
Also, aside from the source code, if the MadChess project is only providing the exe and not the dll files, then I think it's safer to stick with the approach that is implicitly "recommended" by the project. You don't know what kinds of issues you'll run into when you try to make the dll files yourself (and it sounds like you have been running into issues already).
Even though it should be possible to use dll files, I think it's preferable to pick the approach that will let you progress on your project faster. You can always switch to Approach 2 later if you run into other issues.
(Just make sure to show appropriate errors in case MadChess.exe is not found, so that you can troubleshoot issues quickly.)
How to include MadChess.exe as part of your build
You don't necessarily need an installer to include the MadChess.exe file with your game. You can also copy MadChess.exe as part of the Build Player Pipeline. Using either BuildPipeline.BuildPlayer or the PostProcessBuildAttribute, you can get the path of the built project, and then use FileUtil.CopyFileOrDirectory to copy MadChess.exe during the build step.
Also, as #AdrianSgro mentioned in a comment, StreamingAssets works as well. (But note that the documentation explicitly mentions that .dll files in this folder are not included if you need to include any dll dependencies.)
I'm working on an online video game project using Unity3D for the clients, and C# servers.
I'm trying to use some code eval for a specific feature, but I can't get it to work.
I went with Mono, because it seemed to be one of the lightest and one of the simplest. I installed Mono and got the "Mono.CSharp.dll" for .Net 4.6 from "Mono\lib\mono\4.6-api". (Both Unity and my servers are configured to use this version of .Net). I dropped it in the Unity assets, and referenced it on my servers.
But I have errors on both Unity and the servers. In Unity there is :
Loading script assembly "Assets/Scripts/Common/References/Mono.CSharp.dll" failed!
And there is an exception on the servers (my IDE is in French so I can't really copy/paste it), but it basically tells me it can't use Reference Assemblies for build, but only for reflection.
To describe the feature I want to create (because you'll maybe have a better solution), I want to be able to create spells from an external tool. Spells are made of SpellEffects. Let's say there is a SpellEffect called DealDamage, constructor takes an int (for the damage amount). I want to be able to write "DealDamage(50)" on my external tool, then take the string, and build a new DealDamage(50) from it.
I know I could find a way to interpret some code by myself, but it would be a lot more work for a far less flexible system.
It was really hard to find any help online for this problem, so as a last hope I'm turning to you.
I'm not exactly sure why you're trying to import Mono into Unity. It's already included in the installation package. If you want to make a modular spell builder, just create a regular application with your preferred language, in your preferred IDE, and save all of your spells as a JSON or XML file, and then import those into Unity. On the Unity side, just build a class to parse the files.
To get you started, take a look at the JSON.Net library. You can serialize your files into C# classes with it.
So, I need to obtain the current audio playback that is happening on my pc programatically in real time. This includes all the audio(you can check this in the playback devices tab of the Sound settings). I need it because I'm doing an analysis over the stream which I then put into use in another software. Until now, I've used the 'StereoMix' option, which actually relay's the current audio as an input(something like an internal microphone). However, I can't use this method when I connect external speakers to my pc(through HDMI, PC/AUX works though).
Is there some way to obtain the audio stream no matter if external speakers are connected or not.
The programming language does not matter in the current case, everything is fine with me. However, I prefer if there is a C# / Processing solution.
EDIT:
Here's the technique(and method) I currently use to obtain the audio in http://code.compartmental.net/minim/minim_method_getlinein.html. The library/code is related to Processing: https://processing.org/.
Basically, NAudio would be a good place to look for a prospective solution. Its not quite clear what you intend to do with the audio such as if you're recording/dumping data, or simply analyzing live-data so I'm thinking NAudio is going to have something such as you're looking for, as far as getting your hands on live-data.
NAudio has an FFT, but not quite robust in the area of analysis as the JS-libs you may be accustomed to ;)
http://naudio.codeplex.com/
https://github.com/naudio/NAudio
There are plenty of examples provided to get you started, and many in the wild.
Though its pretty outdated and the API may or not look slightly different (in regard to...), the following video may provide a nice relaxing quick-start to help familiarize you with this lib.
C# Audio Tutorial 6 - Audio Loopback using NAudio
currently i am implementing an application in Unity3D (C#) that will be exported to Flash and WebPlayer Version.
The Application uses JSON to communicate with the server.
My question is: is there any JSON-Parser that works in Unity WebPlayer AND Flash??
i tried MiniJSON Flash Version already. After spending hours to make it to a clean export it decodes JSON in UnityWebPlayer but returns NULL in Flash.
Is there any other way to parse a JSON string in Unity WebPlayer and Flash? Or is there another JSON-Parser that works in Flash too?
I really searched a lot but either the people provide links to MiniJSON or suggest to wait for Unity3D version 4.0.
I even tried the Proxy-Class feature of unity3D but couldnt get to run it on Flash side. Maybe someone could provide an example for it?
Thanks very much
I use LitJSON for Unity and had no problems when I built a web player version for testing purposes a while ago. I have no experience with Flash player but according to this presentation Unity and Flash, the best of both worlds! - Unite presentation slides page 18 ff. it should do the job.
No JSON library written in C# is likely to work with Unity's flash export (if you want strongly typed objects on the client side) because some key .net reflection pieces are not supported, even in the official 4.0 release. I asked Unity to sanction a supported JSON parser that could be used across desktop, web player and flash and it just didn't happen for this release.
I ended up using native AS3 stringify and parse methods on the client side and JSON.net on the server side. The tricky part is compensating for the name mangling that Unity does when it converts your C# to ActionScript. I was able to make this work without hard coding by using some of the standard ways to override parsing and serializing JSON strings, using a lot of describeType(). Since JSON.net is supported in their web player, I was able to use some #if FLASH pragmas to get both working well depending on build target.
So....it is possible, and perhaps I've done much of the hard work for you. If you want some examples let me know.
-Tray Weeds
Try this: https://github.com/ironmagma/jsonparse
It is completly written in UnityScript. Probably it helps and works in Flash Export. But i did not test it.
So, I have this desktop app built using WPF and C#. It's basically an offline course system that has videos, quizzes, and other assorted content. My dilemma is that I don't know how to protect the videos once they are downloaded and installed on the users machine? Are there any DRM systems out there that I can look into? I thought about storing them in a local encrypted database but I don't even know where to start with that (or if there is something else out there that I'm totally missing...)
Don't even know where to start looking on this one - any ideas?
this question might be helpful, but don't spend too much time on it as any DRM is likely to be broken (they spent millions trying to protect blu-rays and couldn't). At best you can deter the casual user, but you won't prevent the determined hacker, so don't waste time trying.
you could do something trivial to make sure that the files as is can't be copied and played as is (like swap a few bytes round in the header of the file to make it seem as if its garbage so won't be played, then unswap them in memory when you read the file - just an example, I'm no expert)
I've seen Bink video used in some games. I believe it has some sort of built-in "scrambling system", but I might be wrong.