Hello all who's reading! This is gonna be a cry out from my experience with Xamarin for the last few days. If you're looking for a Q/A post, then move along.
From reading around everyone is praising Xamarin to the heavens, and sure enough i tried it out by myself and witnessed things i thought impossible.
After setting a checkbox on the Mac i was able to "pair" it with visual studio. And by some miracle of innovation mono was installed and i saw my iPad on the list of devices. As i witnessed the project deployed the device and running in less than 30 seconds. Something that prior would take me 30 minutes tinkering with XCode's nightmare of codesigning. This must be the future i thought to myself.
I remember having worked with this system back in 2015, back when Xamarin was private and charged exorbitant fees. Now few years after the Microsoft acquisition making Xamarin free for everyone i thought there would be less DRM/BS and more non-rich developers working together dealing with the kinks and bugs of Xamarin.
I'm taking a slash at Xamarin for my current employer, who's developing an interior design App built on Unity3D. Unity has it's kinks. But looking at the old monolith of 50'000 lines of no mans code, it was apparent that there was a years of technical dept. After the team was laid off, the technical dept finally came haunting. Nobody knew how to even build the project.
Thus, i began looking elsewhere. I remembered an old memory. Xamarin.
Since our app is very UI intensive, building with XAML sounds far more appealing. We'd still need 3D though to which i found: UrhoSharp
Running Xamarin.Forms together with UrhoSharp would be the absolute dream solution.
But it's been a week, and all i accomplished was a spinning cube, and it's predecessor, the spinning sofa. What happened? Let's begin!
Xamarin, while deployment was wonderful initially, turned into a mess of weird and unpredictable errors. Who knew that updating NuGet would render my project inoperable? I didn't. That was 1 day wasted. Searching forums and digging on GitHub error reports all converged to the conclusion that the package update is what caused the problem. huh?
Working to get a spinning cube running as simply as possible. I had initially followed the tutorial on UrhoSharp in which you were told to first install the NuGet package, and then (for windows) set an "asset" path. Having no assets yet i proceeded to execute the project and was presented with an exception about missing assets. I guess that was to be expected. I went and created some dummy assets, not having any knowledge about the asset pipeline of this... Urho. I went to study the samples "FormsSample" to be exact. It ran fine on the computer, android and windows. Liberally copying the files from the sample to my project i still couldn't get the program running. Digging further and futher, hours went by. Differences i did find was the .csproj. Mine being 10 lines long which seemed to control the way NuGet packages was handled. In my project packages had this cute little blue NuGet icon. In the sample project they were just traditional references. Which in turn on also meant the presence of the "packages" folder.
So not knowing how one would set up a project in this manner i despised my actions from that point. I went and copied the entire sample project and replaced all the strings in the project with my projects name. I got rid of all the stuff in the project and replaced it with a spinning cube. This worked!
I hurried to commit this working code to SVN. And went ahead to getting resources working. (That is showing a textured sofa)
Documentation was misleading and i tried for an entire day to show a .obj file until i arrived at the answer that .obj was not supported, despite the fact the documentation stated it supported existing formats (Whatever that really meant). There was a NuGet package to solve this "UrhoSharp.Tools" had something called "AssetImporter". Spending an hour searching how to use this package. I typed the namespace in C# and nothing showed up. There wasn't even a reference on the list. Wtf? I used a filesystem search and found that inside the packages folder it existed as an executable. No docs stated this. Whatever. I converted it and attempted to run my project.
It ran, but it was just a spinning cube. Old code? Looking the internet... again. So seems i have to now, manually right click the project and click "Deploy" to run the program on pc. I never did that before, apparently there is a checkbox for deploy in the build settings that sometimes, by magic unchecks itself. Nice? Anyway, i actually got the sofa spinning. With texture.
Time to test on iOS!
This was the time the despair really started to settle. I ran the iOS project. The iPad woke up and my app launched. Except, it was the spinning cube. flips table Why was this the old version? No clue, but i'm not the only guy with this problem it seems. Stackoverflow had many suggestions.
Deploy produced an exception. "Delete bin & obj" Did nothing other than proventing the app from building altogether. So my success was short and now back in the abyss. I tried reverting my code to the earliest version. The last suggestion on the list... New project, migrate code. I really didn't wanna, but now it's done, the app it running. On the computer and iPad.
Or should i say it didn't, because the iPad threw and exception:
"Unhandled exception: ". I knew exactly what went wrong (Hint: I hadn't the faintest idea).
Well well. After some more internet, slapping a try/catch block around the guilty line actually helped me to determine the exception details.
So we arrive in the now. Because the error looked like this:
"Failed to compile pixel shader PBRLitSolid(DIFFMAP IBL PBR): ERROR: 0:110: 'f' : syntax error: syntax error"
Surprisingly non-cryptic for Xamarin's usual standard.
Anyho, i located the shader in question, guessing that 0:110 means column 0, line 110. > "blank line". Yup. Nothing to be found here.
Internet... Again. Turns out iOS couldn't handle the f "prefix" being not part of the glsl standard. I wouldn't know, i'm not familiar with either. My solution would probably be something akin to having a PBR shader for each platform. If i could find one that runs on iOS that is.
Reaching the end i have to reflect. Is this really worth the trouble? So far, almost nothing has worked out of the box, and who if i'll even be able to find that elusive shader, i could try and update UrhoSharp but it depends on a later version of Xamarin, and i remember all too well how that went.
Honestly, i despise Unity3D. I really wanted Xamarin to work. Even if i get the elusive pbr shader working (assuming it exists), is that the end of it? Will i keep getting knocked down by Xamarin's build system? Will i keep spending entire days finding why my project suddenly corrupted itself? I really don't know. I'll try to find that shader, if not, it may be the end of this road.
With that my story ends. I hope you enjoyed reading this, as much as i enjoyed writing it. Comments, suggestions, death threats are welcome altogether.
~ Foxxy out ~