Forum Visual Studio

Using Xamarin Studio to develop Unity3D games

tbergerontbergeron CAMember
edited June 2013 in Visual Studio


I've been using Xamarin for several different reasons like Mac development, iOS development and Unity3D game development.

It works well for what it is meant to but for Unity3D development, there's still a few quirks.

I tested this bug on all branches, now using Alpha and it always happen. I've made a little gif to demonstrate the problem:

Everytime I create a new line and type a function call, right after I complete the last (), the block gets indented, but wrongly indented. Unity uses normal and plain C# code most of the time and shouldn't have trouble being handled by Xamarin.

I don't get why this is happening, maybe somebody will have a clue after looking at the image.

EDIT: As of other issues I had in the past: everything I pointed out has been fixed by Xamarin's team which is awesome and the unity integration goes fine too. That's the only remaining issue I'm having.

Any suggestions? Thanks and have a nice day!


  • mhutchmhutch USMember, Xamarin Team Xamurai

    Have you checked your solution's code formatting settings? It looks like the on-the-fly formatter is formatting your line on the semicolon.

  • tbergerontbergeron CAMember

    I thought so too, is there any way to reset all code formatting settings to defaults? Maybe I broke something :P Thanks

  • tbergerontbergeron CAMember

    You were right, I switched everything back to Mono and now it's working normally. Thanks!

  • tbergerontbergeron CAMember

    This bug still persists with the latest alpha build, the fixes that worked in the past aren't working anymore. I cannot use Xamarin for development anymore or else I have to reformat my code manually as soon as I type something.

    Please help me. Thanks!

  • tbergerontbergeron CAMember

    I'm going to try to completely remove my preference files to reset everything. I hope this is going to work because I'll unfortunately have to stop using Xamarin which is IMO the only good way of getting some real Unity3d work done.

    I'll update the thread with my findings.

  • AndyKorthAndyKorth USMember

    I had the same issue with Unity projects. Make sure to check the Code Formatting options in your Solution. The solution may override your app settings. It's also possible for the project "Assembly-CSharp-vs" (and the other two), can override the solution as well.

    I think there is something very odd with the formatting "(Custom)" that is set up in the solution that unity creates.

  • WillWill USMember

    Yup, I just had this problem myself but fixed it! I right clicked the solution, went to options -> code formatting -> c# source file and sure enough it has its own settings. Indent width was set to 8 for me, I turned it down to 4 and life makes sense again. Above post covers this, but thought I would respond, just in case. This bug is infuriating, isn't it?

  • tbergerontbergeron CAMember

    Just a bump to tell Xamarin's staff that this STILL persists and now in a Xamarin.iOS project!

    I reverted everything back to defaults, and as always it starts happening in the middle of nothing. I haven't touch my code prefs since months now.

    Why is this still happening? This is painful to work with!

    I'll now try to update to an alpha build or something more current maybe that'll help.

    Please help me, thanks.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    This might be bug 15962 which is a regression that crept into 4.2.0. It should be fixed in 4.2.3.

    If that's not it, then could you please file a bug for @MikeKrger to fix?

  • MikeKrgerMikeKrger DEXamarin Team, Beta Xamurai

    Check your project settings - may be 8 spaces indent.

Sign In or Register to comment.