Load data and formula from a file?

Let’s say I have a starship component like this:

Name: Nuclear Rocket
Type: Propulsion
// Other data

Resources: 1

Resource Name 1: Nuclear Fuel // Name would be indexed against available resource names.
Resource Use Type: Consumes // Also Stores, Produces…
Resource Use Formula: (sqrt(ComponentSize) / Sqrt(RelativeTechLevel)) * // …more math.

Where the formulas and data would be used during runtime.

Now, most obviously, a scripting language would be useful, here. This suggests several questions:

  1. Is it possible to load in C# .dll Assemblies in Unity C#? Because I already know how to do that, and if it’s viable in Unity, I could write something myself if nothing else.
  2. Are there existing scripting language packages that could handle this? (probably)
    2b) If so, what would you recommend?
  1. Yes: Unity - Manual: Managed plug-ins
  2. Yes: Google
    2b) Use a script to convert your txt files into c# code and compile them. Otherwise you will be very vulnerable to an injection attack
  1. I apologize; I was asking if AppDomain.Load(Assembly) works in Unity.
  2. See below.
    2b) I gather you do not agree with using scripting languages? Could you explain some of that, as they seem popular.

Thanks.

  1. I’m not 100% sure about that - but I think the method in the documentation will achieve what you are trying to do won’t it? It has the added benefit of being supported by the Unity staff.
  2. I’m not totally against it, I just think you should be careful when applying it - in particular consider the security risks. I think scripting languages can be a very powerful tool especially for quick iterations on domain specific content. However it is sometimes assumed to be the best approach without consideration of alternatives. Personally, I like the idea of converting to c# and compiling the code. That way you can get protection using existing and well known mechanisms such as obfuscation, code signing and memory testing. Of course nothing is bullet proof…