Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MultiPlatform ToolKit - Multiplatform development, simplified.

Discussion in 'Assets and Asset Store' started by gtjuggler, Oct 18, 2011.

  1. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Hi, quick question.

    I'm sure this will sounds remedial, but multiplatform is still voodoo to me. Does your extension support some, or any of the Android tablet options without too much gyrating on my part? Does it have any presets I guess? How bout the Ouya console.

    Would love a tut even with simple colored polys/sprite that represent buttons and GUI stuff. just a run through for setup technique.

    thanks,
    B.
     
  2. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    Hey there. Assuming you have already purchased it, just crack open the testScene.unity scene and take a look there. Hit play and it will apply the platform which is chosen currently in your EasyPlatform toolbar (found under Window -> Multiplatform Toolkit -> EasyPlatform).

    Click on a few items in the scene and look at the PlatformSpecifics components on them and observe how they are set up. That should be all there is to it! Also make sure to check out the tutorials at http://smuggletruck.com/multiplatform
     
  3. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Didn't purchase yet, but think I must. Multiplatform is the way, I just hurt from learning new stuff. Thanks.
     
  4. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Can the MPTK make dynamic adjustments to size and position of game objects like menus and HUD?

    For example detecting what kind of iOS device the game is running on and repositioning/resizing accordingly?
     
    Last edited: Sep 28, 2013
  5. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    Yep! That's actually the primary use of MPTK. MPTK detects the current platform / variant (iPhone Retina vs iPad vs iPhone 5, for example) and can make changes on position, scale, anchoring based on this platform detection. Please see tutorials 1, 2, and 6 which are the most relevant to you, on the documentation site here: http://smuggletruck.com/multiplatform/
     
  6. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi,

    I've made an app for iPad 1, 2, 3, 4 and now i need to rebuild this for Android. I'm thinking of supporting these resolutions:
    2560x1600
    1920x1200
    1280x800
    1024x768
    800x840

    My textures are scaled for a 2048x1536 resolution (so 1024x768 shouldn't be a problem.) I'm using NGUI for all my GUI's. What's the best way to get all my textures right for all resolutions? Can I add custom resolutions to Multiplatform toolkit? Or should i use aspect ratio's?

    I'm already busy doing the 1920x1200 resolution, i noticed that in Android there is an action bar on the bottom of every device which is about 96px so i should think about that aswell. I now have set my UIRoot toFixedSizeOnMobiles and the height is set to 1104 (1200 - 96). Is that the right way to go?
     
  7. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    Hi. Simply choosing to support a list of Android resolutions is definitely not the way to go. MPTK uses aspect ratios on Android and I highly recommend using them. Please see Tutorial #5 in the recently updated documentation (http://smuggletruck.com/multiplatform/) for information on how to deal with texture swaps and especially atlas swaps using 2D Toolkit / NGUI.

    As for the UIRot and all that, I would either use NGUI's positioning functionality and not use MPTK's, or the other way around, otherwise you'll probably see them both trying to position objects simultaneously.
     
  8. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    I would like to use MPTK's positioning functionality, but what would i need to delete from NGUI in my project? Is it only the UIRoot?
     
  9. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    There's no need to delete any files from your project. Just simply don't use anything that repositions transforms automatically in NGUI if you want to use MPTK. I would experiment with various methods of aligning/moving objects to your liking. I would read up on NGUIs tutorials and MPTKs tutorials to familiarize yourself with what each function does, and UIRoot seems to be explained in further detail here: http://www.tasharen.com/forum/index.php?topic=1398.0
     
  10. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Thx for your reply, but there is something i don't get. If i'm only using the MPTKand i have scaling on Aspect ratio turned on. How does that work when for instance I have my textures at 2048x1536 which is 4:3 and i'm running it on iPad 2, 3 and 4 how do I set the scaling for 1024x768 when switching to iPad 2? Or does MPTK scales automatically to the right resolution?

    Edit:
    Essentially what i'm trying to achieve is to only scale the background to different aspect ratio's and scale / reposition the sprites for the appropriate aspect ratio so I don't need different atlasses or sprites for the iOS and Android versions
     
    Last edited: Oct 2, 2013
  11. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    In Unity, everything scales up based on resolution. If you go from iPad 2 (1024x768, 4:3 aspect) to iPad 3 / 4 (2048x1536, 4:3 aspect), everything gets blown up to size properly. You don't need to do anything. That's not a MPTK feature, it's just how Unity works when rendering any transform.

    With MPTK you can take the texture itself and swap it to a higher resolution texture to increase the quality of how it looks on iPad 3 / 4. See the tutorial linked above for more info on how to do that exactly.
     
  12. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,152
    is it possible to cache imported assets per platform with your asset? so far i haven't use build features of your asset. i have big projects and platform switching takes long time.
     
  13. FIllbiker

    FIllbiker

    Joined:
    Jun 9, 2010
    Posts:
    118
    I'm trying to use this on my GUI Textures but with no luck on iPad 3 retina resolution. I set everything for ipad2 (1024x768), then click on + button, set iPad retina and here the problem starts. How can I set gui texture coordinates if I'm not able to set such a high resolution as iPad 3 has? I can't reposition gui textures to see where it should be. I was hoping that this toolkit can upscale and position this gui textures when I set "ipad retina", but it doesn't. It is completely useless for me. $200 for nothing that I can use. I can rewrite all my guis manually as I had it before and it worked. :(
     
  14. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    Unity's Cache Server helps with this and MPTK doesn't directly deal with the platform switching -- it's all Unity.
     
  15. gtjuggler

    gtjuggler

    Joined:
    Nov 13, 2008
    Posts:
    238
    Hi there. Here's a snippet from the documentation located here : http://smuggletruck.com/multiplatform/

    So yeah, using UnityGUI, some of the features such as positioning, pinning, scaling, etc will not be available because they do not act as 3D transforms in the scene. There's not much you can do with UnityGUI other than use the built-in methods to try to wrangle it. Almost all of the Unity developers I know have moved away from UnityGUI when they realized how restrictive it was.

    That being said, even though I already had a disclaimer and the limitations in UnityGUI are out of my control, if you would like a refund for the tool, I would contact me at support@owlchemylabs.com -- I want my customers to be happy so anyone should get in touch with me if they are not satisfied with the product.
     
    Last edited: Oct 15, 2013
  16. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    I love your tool :) it works very good! I have one question though, i'm having problems with aspect ratio switching. I'm using the following tablets:
    Google Nexus 7 2013 (1920x1200)
    Galaxy Tab 8.9 (1280x800)

    They are both 16:10 aspect ratio, and they both have the android bar on the bottom (the one with the three buttons (home, back, Open apps). But it's not switching right. My Unity3D Game View is set to 16:10 and all my sprites are correctly positioned. Though when I run my app on my Nexus 7 or Galaxy Tab it''s not scaling correctly.
    I also have support for 4:3 and 16:9. Only 4:3 sets my sprites to their correct positions.
    The question is, does this have to do with the bottom (native) android bar with the home button, back butten en open apps button?

    EDIT:
    I just found out that it scales to 16:9 aspect ratio not 16:10 on both devices :(

    Question 2:
    Is it possible to access the variables used in MutliPlatform Toolkit? For instance i'd like to get a value from MPT (position aspect ratio) to tween it to the correct position depending on the platform.
     
    Last edited: Oct 21, 2013
  17. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    Hi everyone , it's probabl a stupid question but i'm really stuck on how to add my tow scene in the BuilProcess script, in fact evrything works graet on easy platform emulator but when i build nothing works as it's supposed to be ?? i guess that's a build issue ..
     
  18. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    Hi Tripwire, i'm a developer at Owlchemy Labs and think I have a quick solution for you.
    If you print out your device resolution for the "Galaxy Tab 8.9 (1280x800)" you will notice its actual usable resolution is "1280x752". Iv'e noticed this is closer to a 25by15 aspect, but not exactly.
    What I would do for now is to add a custom aspect ratio of 25by15 or a custom resolution of "1280x752" in the "AspectRatios.cs" script part of MPTK.

    As an example you would want to do something like:
    1) Open "AspectRatios.cs".
    2) Add "AspectCustom1280x752 = 1280752," to the "AspectRatio" enum.
    3) Add line "const float aspectCustom1280x752 = 1280f / 752f;" in the "AspectRatios" class".
    4) Add the condition checks in the methods "GetAspectRatio" and "FindNearestAspectRatio".
     
  19. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi,

    Thanks for the reply! The only thing is, when i'm adding these lines i realized that when I do this, than i should do every resolution because for instance 1920x1200 real resolution = 1920x1152 because of the android bar. That isn't why I bought MPT. I thought when gtjuggler told me I could switch Aspect Ratio's this was solved?

    Question2 still stands though, is it possible to access the variables i set in the PlatformSpecifics on the gameObject in a script?

    EDIT:
    What line should I add to FindNearestAspectRatio?
     
    Last edited: Oct 25, 2013
  20. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    I sent you a PM with the aspect 25by15 added in. This will come out as an update later as well. Use what I sent as reference to add any more aspects you feel may be needed.

    Yes after adding an aspect to the "AspectRatio" enum it will show in the Unity inspector.

    In the PM I sent, take a look at all the places 25by15 were added. This should give you a good idea.
     
  21. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    Hi, i would like to build my game on android platform devices which contains diffrent resolutions , to do that i use MPTK to rescale and reposition some game elements such as menus according to diffrents aspect ratios . To do that i had to specify the aspect ratio in unity, make the changes and build according to the aspect ration selected , so is there any way to make just one build to do that ?
     
  22. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    No you don't have to do different builds for every aspect. You simply set up your 3D UI elements to the correct position for the supported aspects you will support, then at runtime MPTK will choose your best aspect and place the 3D UI items in there correct positions as you specified at design time.
     
    Last edited: Oct 25, 2013
  23. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    Thanks for the quick reply, well .. infortunatly it didn't work for me when i tryed to set up some 3D UI elements with 5:3 and 3:2 aspect ratios then built and tested on a Galaxy s2 "800/480 == 5/3" ? i don't know what i'm doing wrong could it be "BuildProcess.cs" issue ??
     
  24. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    Could you print out "Debug.Log(Screen.width, Screen.height)" and get the logcat log from your android device? The usable resolution is probably not 800x480. This would help figure out what ratio is needed.
     
  25. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    Actually i'm sure it's 800/480 because when i set the aspect ratio in unity to 800/480 "apply changes to scene" and build it works , and this is what made me belive that i should do the same about every aspect ratio :confused:
     
  26. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    Sounds like you're only setting one aspect...?
    You need to add multiple aspect.
    I'm not sure what you are doing, could you send a screen shot via droplr or something?
     
  27. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    $im1.jpg

    so as you see i'm setting 2 ratios 5:3 and 2:3 fo my 3D UI element
     
    Last edited: Oct 25, 2013
  28. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    For sanity reasons just to get this out of the way could you print out your resolution on the device?
    Just to make 100% sure its "800x480". If its Android 4 its not going to be that rez.

    The side bar on Android 4 will subtract from that rez... as the physical phones rez is 800x480, the usable rez will most likely not be that on Android 4. I don't have a device with that screen size on me thats Android 4, so I can't test at the moment myself.

    Just check what "Screen.width/height" is in Unity when run on the device.
     
    Last edited: Oct 25, 2013
  29. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    ok so i wrote "Debug.Log(Screen.height); Debug.Log(Screen.width);" and it shows exactly 480,800 !!

    it's really strange that it doesn't work but .. does MPTK choose your best aspect on awake or at runtime ? i'm asking because some of my 3D UI elements are set to inactive on awake .
     
    Last edited: Oct 25, 2013
  30. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    Then yes that is your problem, it will not set there positions after Awake.
    You can try to manually call "PlatformSpecifics.ApplySpesifics(Platforms.platform);" after you enable your gameObjects.
     
  31. Ahmedbenchedli

    Ahmedbenchedli

    Joined:
    Mar 1, 2013
    Posts:
    25
    ok, thanks a lot for your help i really appreciate it , you've been a great help :D
     
  32. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi zezba9000,

    Thanks for the PM and reply. But I meant something else with Question2. I'd like to access the variables I set in the inspector in a script. I'm using tweeners to animate transitions between screens, and when i'm changing aspect ratio's the tween variables are changing. What i'd like to access from MPTK:
    Per Aspect ratio Local Position per GameObject
    Per Aspect ratio Local Scale per GameObject
     
  33. jimboyte

    jimboyte

    Joined:
    Feb 25, 2013
    Posts:
    23
    Can MPTK help with a LITE and FULL version on the same PLATFORM?

    Could you help me with how I might be able to use MPTK to control the Android build of both a lite and a full version of my app. I just bought MPTK today so I am searching for this info. Ideally I would like to maintain a single maim menu scene because it is referenced by multiple other scenes. But in my Main Menu scene I have components that I want to adjust within Platform Specifics so that they appear in the full version but not in the lite version. But note that the lite and the full version are both Android builds. I do have Unity Pro 4.2 on a Mac.

    Please help me in how I can best accomplish this? I think if you can help me get started in how I can modify the scripts so that I can have an Android lite build and an Android Full build then I will be able to apple the principles to the rest of my components and to the rest of my C# scripts.

    THANKS so much for making a great product and your willingness to help!
    jim
     
  34. soundwav_

    soundwav_

    Joined:
    Apr 23, 2013
    Posts:
    12
    Hi, I'm thinking of buying MPTK, but just wanted to verify a few things beforehand :)

    First, I believe there is an easy way with MPTK to load different scenes for different platforms on Startup, right?

    Second, I have a Top Bar that will be shown for the entire game, across different scenes throughout the game.
    On tablets, that bar should have a certain height, bg image, button layout, etc.. and on Phones, that bar should have a different layout.
    How is this done in MPTK? Do I change settings on that one Prefab of a Top Bar, or do I make a couple of Prefabs of the bar and load the appropriate one on each scene load?

    Thanks :)
     
  35. Ox_

    Ox_

    Joined:
    Jun 9, 2013
    Posts:
    93
    Is the updated version on the way? I'm getting many warnings in Unity 4.3 (mostly about undo stuff). Thanks!
     
  36. Contract-killer

    Contract-killer

    Joined:
    Sep 21, 2012
    Posts:
    42
    HI I am using your framework but have lot of issue in making build. all the framework are lost . can you explain the issue and solution
     
  37. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    So with the new NGUI 3.08 is it still better to use MPTK or not? Because with the new anchor system it should be really easy to create multiplatform apps.

    Also i didn't get a reply to my question about accessing the local position per aspect ratio through script :(

    EDIT:
    Is it also possible to user local position per platform and local position per aspect ratio together? For iPhone platform it is easy to use the platform. But when using Android i'd like to use aspect ratio instead of platform switching
     
    Last edited: Jan 8, 2014
  38. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I'd sure like to see a comparison between Multiplatform Toolkit and this new similar Asset… Advanced Builder
     
  39. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    I've been using Multiplatform Toolkit for a while now and it's really nice.

    Recently I've switched to DaikonForge and would like to know how to use MT with Daikon.

    Cheers.
     
  40. vickygroups

    vickygroups

    Joined:
    Apr 2, 2014
    Posts:
    16
    fixed my build errors - I had left the path off before the file names.

    compiles and looks fabulous on iOS. Android versions are too spread out. Might be a bug with Android? Anyone edit their layouts with a specific margin to get the Android looking better?
     
    Last edited: Apr 30, 2014
  41. MagicFrame

    MagicFrame

    Joined:
    Jul 18, 2013
    Posts:
    42
    support abandoned, I have sent two emails before buying, and both unanswered, before buying I wanted to be sure that this tool was good for my project, I have seen in the documentation which is very easy to know if you are in iphone, iphone 4, ipad etc ... just this line of code Platforms.platform ==platform.iphone, I can know that I'm in a resolution of iPhone, but what about android? The documentation does not say anything, as could access aspects of Android? This plugin has something like Platforms.platform == Android.Aspect16by9?? As you can access this information?
     
    Last edited: Jun 3, 2014
  42. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Is there a way to effectively control local scale based on aspect ratio?

    It appears to be impossible to set a scale on any of the aspect ration options.

    The way I solved this on iOS was using the local scale per platform but I wanted to control how this specific game object looks on Android to no avail. After about 20 tries I gave up and specified the Inspector scale to a value that was acceptable but again I couldn't see any results on Android with the Local Scale per Aspect Ratio.

    Any help would be appreciated.
     
  43. jasonMcintosh

    jasonMcintosh

    Joined:
    Jul 4, 2012
    Posts:
    74
    If you want to deviate from the defaults provided in the kit, you will be forced to edit its source code, which is not pleasant. I have found that to create a custom build target is error-laden and a lot of effort. The code is not well architected, sadly. Although, I will say that it works quite well for those who don't need any customizations (maybe the majority).
     
    shaderop likes this.
  44. shaderop

    shaderop

    Joined:
    Nov 24, 2010
    Posts:
    942
    I'll have to agree with this assessment. I purchased this kit a long while back, but ended up rolling my own build system, mostly because of the rather long, non-modular, slightly confusing build script that was included. We didn't need any of the per-platform positioning and replacement stuff because we used 2D Toolkit and it covered or made it easy to cover all of those scenarios.
     
    Last edited: Jul 15, 2014
  45. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    For each platform, I would like to generate an asset bundle and have each platform use the generated asset bundle. How can this be done with MMP.

    Cheers.
     
  46. Ox_

    Ox_

    Joined:
    Jun 9, 2013
    Posts:
    93
    Hi!

    I'd like to propose changes to your AspectRatio class (I always make them in my projects).

    Now AspectRatio has two custom resolutions and a very strange one (25:15). I added comments with actual ratios you will get by dividing greater number by lesser one.

    Code (CSharp):
    1. const float aspect4By3Ratio = 4f / 3f; // 1.33
    2. const float aspect5By4Ratio = 5f / 4f; // 1.25
    3. const float aspect5By3Ratio = 5f / 3f; // 1.66[!]
    4. const float aspect16By9Ratio = 16f / 9f; // 1.77
    5. const float aspect16By10Ratio = 16f / 10f; // 1.6
    6. const float aspect3By2Ratio = 3f / 2f; // 1.5
    7. const float aspect25By15Ratio = 25f / 15f; // 1.66[!]
    8.  
    9. const float aspectCustom1024x600 = 1024f / 600f; // 1.7
    10. const float AspectCustom800x480 = 800f / 480f; // 1.66[!]
    As you can see, 25:15 and Custom800x480 are unnecessary because actually it's 5:3.

    And 1024x600 (WSVGA) is rare nowadays (old Android tablets prefer this kind of resolution) but it's still has its own aspect ratio: 128:75.

    What do you think about:
    • removing custom and 25:15 options
    • arranging resolutions from the most square to the most stretched (so it's possible to compare to enum like "ratio > AspectRatios.aspect3By2Ratio")
    • and leaving ratio comments so it will be more clear to a person who digs into aspect ratios for the first time
    Code (CSharp):
    1. public enum AspectRatio
    2. {
    3.     AspectOthers = 0,
    4.     Aspect5by4 = 125,
    5.     Aspect4by3 = 133,
    6.     Aspect3by2 = 150,
    7.     Aspect16by10 = 160,
    8.     Aspect5by3 = 166,
    9.     Aspect128by75 = 170,
    10.     Aspect16by9 = 177
    11. }
    Code (CSharp):
    1. const float aspect5By4Ratio = 5f / 4f; // 1.25
    2. const float aspect4By3Ratio = 4f / 3f; // 1.33
    3. const float aspect3By2Ratio = 3f / 2f; // 1.5
    4. const float aspect16By10Ratio = 16f / 10f; // 1.6
    5. const float aspect5By3Ratio = 5f / 3f; // 1.66
    6. const float aspect128By75Ratio = 128f / 75f; // 1.7
    7. const float aspect16By9Ratio = 16f / 9f; // 1.77
    Thanks and good luck with Dyscourse!
     
    Last edited: Feb 6, 2015
  47. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392

    I think I know what my problem is.
    Android devices advertise their aspect ratios and resolutions, but a lot of times these include the soft buttons.

    Since my testing Android device has soft buttons I would never never nail the correct placement.
     
  48. Ox_

    Ox_

    Joined:
    Jun 9, 2013
    Posts:
    93
    AudioAsset is completely broken in Unity 5.

    Fix please! :D

    Also no BuildTarget.FlashPlayer, BuildTarget.NaCl. And BuildTarget.MetroPlayer is obsolete.
     
    Last edited: Mar 4, 2015
  49. gshape

    gshape

    Joined:
    Aug 8, 2012
    Posts:
    104
    Unfortunately, this plugin is completely broken in Unity 5, hope there will be a fix soon.
    Thanks.
     
  50. Plausch

    Plausch

    Joined:
    Nov 30, 2013
    Posts:
    2
    Yes. Please update the plugin and made it compatible with the new Unity version. (Unity 5)