Are there any viable options for coding in Unity besides C#, Boo, and JS?

I’ve heard of IL2CPP but I’m not sure what it is.

TBH I just wanted to bleep about Microsoft and C#.

Until this point everything had been hunky dorey with C# for me.

I finally learned what XML was and thought “That sounds so easy! Maybe I will try storing AI maneuver data in an XML file!”. I googled tutorials on XML and C#. Found some examples, some of which didn’t work so well. Guess I’m on my own for part of this at least. Found the MSDN documentation.

Six hours later I find myself frustrated beyond belief, oh and my keyboard is kinda sweaty now. I’ve since concluded that MS wants to make everything more difficult for programmers. I never thought much of that common sentiment. Guess it holds water.

I guess my real question is how do professional engineers deal with Microsoft’s bull?

IL2CPP is the program Unity has developed to convert IL (the intermediate language C#, Unityscript, and Boo compile into to run in the mono/.net frameworks).

What problems did you have?

Well… XML isn’t from MS first off.

Not sure what you intended to store in XML… not exactly what I would have used it for, not sure what “AI maneuver data” is.

What issue did you have, maybe we can help.

Well many don’t go near MS, they might be Mac devs, or Linux devs, or mobile devs, or web devs, or they just don’t like MS technologies.

Others like it just fine. Personally I find the documentation and support MS gives to their technologies, like .Net, is actually superb. Not perfect mind you, nobody is perfect… but MSDN is honestly the documentation to which I hold most other documentation to as an example of what good documentation looks like.

…

anyways…

I’m not sure what problems you’re having.

But it might not be an issue of documentation, and just an issue of being a novice.

You mention you didn’t know what IL2CPP is, and the you just learned what XML is. This says to me that you’re rather new to this field.

If that’s so… there’s a lot of work to getting into programming.

It’s not exactly “easy” stuff to do.

But with patience, and practice, you’ll get there.

Honestly, not gonna lie… 6 hours is not that much time.

I’ve been doing this for over 10 years, and I STILL find myself pulling all nighters with a case of mtn dew just to learn new technologies. Linux/OSX/Windows combined (as well as other os’s you probably have never heard of).

I know XML isn’t an MS product. I was trying to use the .NET libraries for XML like LINQ and stuff. I may just be tired (its 2am here…).

By “AI maneuver data” I was talking about a path defined in an XML file which could be loaded in to a game and used for static AI movements.

I did manage to get a file properly written but its going to be tomorrow or later before I can read the tutorial again. I thought it was gonna be easy and I was very hasty so I lost that code (thought it would be maybe 15 lines) and wasn’t using VC. Using XMLTextReader to read the file was what was impossible.

OK… now you brought up XMLTextReader.

Don’t use that. Hell notice this bit in the documentation for that class:

Note… .net framework 2.0 came out in 2005. So even back in 2005, they intended you to not use that class.

Now you might ask “well then why the F does it exist???”

I won’t lie, several of the XML libraries in .net are HORRIBLE. There’s some good stuff in there, but there’s some terrible stuff as well.

This is because .net was first started to be developed in the 90’s, and XML was very new (96’). The first 1.0 release of .net came with some very weird classes to deal with XML, and is structured around a time period where memory limitations was a huge issue.

So large text files like this were often dealt with in ‘streams’ to deal with the memory foot prints. Note the documentation for XMLTextReader again:

As time progressed, better stuff was released in 2.0.

But still, it was a lot structured around streamed data to deal with poor memory performance.

It wasn’t finally until 3.5 that we finally got what I consider to be an easy to use interface for xml. And that’s the System.Xml.Linq namespace.

I personally would advise sticking to just that namespace if you really want to work with xml… otherwise find a different serialization format (like json, or yaml).

…

Now again, you might be wondering why all this stuff is still there if they are so old.

And that’s because they already added it!

Unfortunately, Microsoft must maintain existing technologies, because code may exist out there based on it. If they went and removed these parts of the library, many programs would stop working!

Furthermore… these technologies still have their use.

Though more complicated to deal with… streamed parsing of xml can be more efficient. Which is good for low memory situations.

…

What tutorial are you using?

1 Like

The xml libraries are horrible? I guess I’m confused, what are you using to read or write XML?
You also might want to read up on the XMLSerializer. It pretty much reads XML into an object, and spits out an object into XML. I mean…it doesn’t get much easier to work with XML than that imo.

http://wiki.unity3d.com/index.php?title=Saving_and_Loading_Data:_XmlSerializer

I was specifically talking about the older xml libraries.

There’s numerous ways to parse XML in .net, and yes, several of them are outdated and horrible.

Nevermind. Figured it out. It was just a matter of using XMLReader and XMLWriter. Don’t know why I kept trying to build a tree and save it like I was.

I’d add that if you’re new to programming and new to Unity, you might want to try using Unity’s ScriptableObjects or Prefabs for data like AI paths instead of trying to shoehorn in XML for no good reason. Even JSON would probably be better than XML, since Unity’s got decent built-in support for that.

1 Like

I don’t think Microsoft has a bad reputation when it comes to its development tools at all.
They have a bad reputation for a lot of OTHER things, but they have a very good reputation for their development tools,

Visual studio is amazing.
.Net is amazing
And C# walks the tight rope of intuitiveness and power very well, that’s its major strength and competitive edge.
For this reason, the internet is absolutely full of C# resources as well, which is very convenient.

2 Likes

So true, I was dealing with C++ and assembler for a long time, and C# is a blessing. If you know how, C# can do everything that you can do with C/++ as well.

But what I don’t get is why anyone would want to deal with XML unless you’re doing anything web (or html to be more precise) related.

There are awesome JSON libraries out there (Newtonsoft.Json, but I don’t know if that works with Unity).
Unity also has its own JSON serializer that works well.

TBPH I forgot that Unity had some features for saving files (never used them before :P) and I had no idea what JSON or YAML were. I may look in to those later.

it can be made to work, but has lots of problems with il2cpp, if what you need to do is too much for the JsonUtility i have found this to be the best asset for json in unity.
https://www.assetstore.unity3d.com/en/#!/content/11347

it is Newtonsoft.Json but it works with il2cpp and is very well supported.

@ you may found json to be the more idea serialization format for your use, the built in JsonUtility of unity can serialize anything unity can serialize, and if you need more there is the asset i mentioned above which can be made to work on any data type you want, and offers lots of extra flexibility.

1 Like

All of the alternatives to C# in Unity are significantly worse.

1 Like