Friday, 29 June 2018

Creating Asset bundle for device specific in Unity

1. Create a new project in unity
2. Create a new folder “Editor” under Assets folder






3. Create a new script as ExportAssetBundles.cs under Editor
4. Copy and paste the below code, you can tweak the below to create asset bundle for specific devices.

using UnityEngine;
using UnityEditor;

public class ExportAssetBundles
{

    [MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
    static void ExportResurce()
    {
        // Bring up save panel
        string basename = Selection.activeObject ? Selection.activeObject.name : "New Resource";
        string path = EditorUtility.SaveFilePanel("Save Resources", "", basename, ""); // use this to save in particular folder destination
        //string path = "Assets/AssetBundles/test.prefab";

        if (path.Length != 0)
        {
            // Build the resource file from the active selection.
            Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);

            // for Android
          /*  BuildPipeline.BuildAssetBundle(Selection.activeObject,
                                           selection, path + ".android.unity3d",
                                           BuildAssetBundleOptions.CollectDependencies |
                                           BuildAssetBundleOptions.CompleteAssets,
                                           BuildTarget.Android);

            // for iPhone
            BuildPipeline.BuildAssetBundle(Selection.activeObject,
                                           selection, path + ".iphone.unity3d",
                                           BuildAssetBundleOptions.CollectDependencies |
                                           BuildAssetBundleOptions.CompleteAssets,
                                           BuildTarget.iOS);

            // for WebPlayer
            BuildPipeline.BuildAssetBundle(Selection.activeObject,
                                           selection, path + ".unity3d",
                                           BuildAssetBundleOptions.CollectDependencies |
                                           BuildAssetBundleOptions.CompleteAssets,
                                           BuildTarget.WebPlayer);*/

            // for WebPlayer
            BuildPipeline.BuildAssetBundle(Selection.activeObject,
                                           selection, path + ".unity3d",
                                           BuildAssetBundleOptions.CollectDependencies |
                                           BuildAssetBundleOptions.CompleteAssets,
                                           BuildTarget.StandaloneWindows);

            Selection.objects = selection;
        }
    }

5. Now you will be able to see a new option under Assets at the very bottom as “Build AssetBundle From Selection”
6. Now go to hierarch view and create a 3D cube.
7. Create a new prefabs folder under Assets
8. Drag the cube on to the prefabs folder, now you will be able to see a cube prefab
9. Select the cube and execute the “Build AssetBundle From Selection” option under Assets tab.
10. Now you will be able to see an popup prompting to select the destination folder to save the asset bundle
11. That’s it you have now created an Asset bundle


Getting Started with Application Development for HoloLens using Unity3D - Skill Prerequisites

Prerequisites Skill for HoloLens Application Development


It would be great if you have the following skill set. Still don't worry if do not have all the skills, but its time for you to brush up and learn some new skills. Happy Learning :-)


  • Unity - Its an game development tool with customizable and easy to use editor and it quite easy to learn here is the official web page link where you can download it https://unity3d.com/ , and it has a lot of resources to get started with and it too have a strong community to support your queries.
  •  3D Modelling and Animation - Its a must have skill, if you have this skill you can do lot of awesome things in mixed reality world. You can use any of the following tools Blender, 3DsMax or Maya or what ever you prefer. It would be great if you are comfortable with Blender bcoz its an
    Open Source 3D creation tool and it too have a strong community.
  • C# - This is the piece which will add life to your imagination. Here are few resources which can help you to get started with http://csharp-station.com/Tutorial/CSharp/Lesson01.
  • Basic Idea on what is HoloLens and its features - https://www.microsoft.com/microsoft-hololens/en-us/developers
  • A little knowledge on using Visual studio IDE - https://www.visualstudio.com/vs/ 

That's it this should be more than enough to get started with. 

In our next post we will look into setting up the development environments.

Getting Started with Application Developement for HoloLens using Unity3D - Setting up Dev Environment

 Setting up Dev Environment

In this post we will look into setting up our work development environment.

Prerequisites

  • System Requirement
    • 64-bit Windows 10 Pro, Enterprise, or Education (The Home edition does not support Hyper-V or the HoloLens emulator)
    • 64-bit CPU
    • CPU with 4 cores (or multiple CPU's with a total of 4 cores)
    • 8 GB of RAM or more
    • In the BIOS, the following features must be supported and enabled:
      • Hardware-assisted virtualization
      • Second Level Address Translation (SLAT)
      • Hardware-based Data Execution Prevention (DEP)
    • GPU (The emulator might work with an unsupported GPU, but will be significantly slower)
      • DirectX 11.0 or later
      • WDDM 1.2 driver or later
  • Visual Studio 2015 > Visual Studio 2015 Update3
  • HoloLens Emulator > emulator
  • Download Unity 5.5 or later -> Unity  
  • Vuforia (If you planning to build an application based on AR tracking) -> Vuforia Download 

Additional Tips

  1. For more details on tool requirements please refer https://developer.microsoft.com/en-us/windows/holographic/install_the_tools  
  2. Please also ensure that Hyper-V feature has been enabled on your system. To configure hyper V please refer https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v

Getting Started

  1. Confirm that your system meets all the basic requirements and ensure that Hyper-V is enabled.
  2. Install Unity5.5 or later 
  3. Install Visual Studio 2015
  4. Install HoloLens Emulator.

Now you ready to get started with HoloLens development :-) 


Embedding Custom fonts in Captivate

  • Create a new fonts folder under the path below
  • C:\Program Files\Adobe\Adobe Captivate 2017 x64\HTML\assets\css\fonts
  • Copy required fonts into this folder
  • Create a new text document and rename it as fonts.css
  • Place the below code in the fonts.css file . ** this code needs to be edited according to the font which you are embedding

@font-face {
font-family: 'HelveticaNeueLTStd-Roman';
font-style: normal;
src: local('HelveticaNeueLTStd), local('HelveticaNeueLTStd-Roman'),
url(/assets/css/fonts/HHelveticaNeue_3.ttf) format('truetype');
}
@font-face {
font-family: 'Webdings';
font-style: normal;
src: local('webdings_2), local('webdings_2'),
url(/assets/css/fonts/webdings_2.ttf) format('truetype');
}
@font-face {
font-family: 'Wingding';
font-style: normal;
src: local('wingding_2), local('wingding_2'),
url(/assets/css/fonts/wingding_2.ttf) format('truetype');
url(/assets/css/fonts/WINGDNG2_2.TTF) format('truetype');
url(/assets/css/fonts/WINGDNG3_2.TTF) format('truetype');
}
  • Assign the embedded font in captivate and publish
  • After publishing navigate to..\assets\css folder and open CPLibraryAll.css
  • Add the below line of code at the very beginning of CPLibraryAll.css file

@import url("../css/fonts/fonts.css");