Search Unity

Coherent UI - HTML5-based User Interface middleware

Discussion in 'Assets and Asset Store' started by stoyannk, Oct 30, 2012.

  1. Sytto

    Sytto

    Joined:
    Jul 20, 2010
    Posts:
    28
    fixed switching to DX11 :D.. Thanks!! I'm looking forward to buy this. I sent an email to the sales team a few days ago but no one has responded yet. Are there any student/indie licenses for this? It would help a lot!
     
  2. 60days

    60days

    Joined:
    Jan 27, 2012
    Posts:
    23
    Hi,

    I purchased CoherentUI for a project, and after some issues that were solved with the Direct X 2010 patch I still have flash working on some computers but not on others. Could you clarify how plugins like flash are handled - is the webkit browser entirely sandboxed, or can it use plugins on a users machines (hence I need to install some non-browser specific flash plugin on other systems)?

    Also is there a support forum specifically for CoherentUI? on the site there is just the single item in the support section.
     
  3. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    For Flash content Coherent UI uses the system installed Flash player, so you'll need to install it on systems that don't have it.

    There will be dedicated support forum on our website, but I can't promise when we'll get it up and running.
     
  4. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Just checking up again on this. Is it possible to do UnBindCall to remove the binding for an event added by BindCall as well as UnRegisterEvent to remove the event registration added by RegisterForEvent yet? I saw "Handlers called from JavaScript can be unregistered" on the changelog below, but I'm not sure if that's what I'm looking for.

    http://coherent-labs.com/UIChanges/
     
  5. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi, this feature is exactly the possibility to remove the binding of a delegate to a an event or call.
    View.BindCall and View.RegiserForEvent now return a BoundEventHandle. This handle can be used to unregister or (unbind) the delegate using View.UnbindCall and View.UnregisterFromEvent respectively. There is also a convenient method that
    unregisters and unbinds all delegates that have a specific target - View.UnbindObject(target);

    Here is a sample of Unity3D component that uses UnregisterFromEvent and View.UnbindCall

    Code (csharp):
    1. public class UnbindDemoScript: MonoBehaviour {
    2.        
    3.     private CoherentUIView ViewComponent;
    4.  
    5.     void Start ()
    6.     {
    7.         ViewComponent = GetComponent<CoherentUIView>();
    8.         ViewComponent.OnReadyForBindings += this.RegisterBindings;
    9.     }
    10.    
    11.     Coherent.UI.BoundEventHandle m_NewGameHandle;
    12.     Coherent.UI.BoundEventHandle m_EventHandle;
    13.    
    14.     private void RegisterBindings(int frame, string url, bool isMain)
    15.     {
    16.         if (isMain)
    17.         {
    18.             var view = ViewComponent.View;
    19.             m_NewGameHandle = view.BindCall("NewGame", (System.Action)this.NewGame);
    20.             m_EventHandle = view.RegisterForEvent("SomeEvent", (System.Action)this.EventCallback);
    21.         }
    22.     }
    23.                
    24.     private void EventCallback()
    25.     {
    26.        
    27.     }
    28.    
    29.     private void NewGame()
    30.     {
    31.         ViewComponent.View.UnbindCall(m_NewGameHandle);
    32.         ViewComponent.View.UnregisterFromEvent(m_EventHandle);
    33.        
    34.         // or the more easy to use - unbinds all event and call handlers bound to this object
    35.                 // does the same as the two calls to UnbindCall and UnregisterFromEvent above.
    36.         ViewComponent.View.UnbindObject(this);
    37.        
    38.         // start a new game
    39.     }
    40. }
    41.  
     
  6. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Great, thank you. I'm having an issue with it though. As soon as I unregister or unbind Unity completely crashes with the following in the crash error log.

    Code (csharp):
    1.  
    2. CoherentUI_Native.dll caused an Access Violation (0xc0000005) in module CoherentUI_Native.dll at 0023:5a9d9459.
    3.  
    Any ideas?

    Edit:Strange, seams to work ok in a blank scene. Guess will need to dig deeper to see what weird conflict I maybe causing.
     
    Last edited: Aug 18, 2013
  7. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    We are going to need more information to able to troubleshoot the crash. Can you send us the complete Unity3D log? Since it may contain sensitive information I suggest you contact us at support@coherent-labs.com. Also if you can send us a project with the reproduction case would greatly help us fix the issue faster.
     
  8. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    I think the crash is my fault. Believe I'm making it get stuck in a loop as well as losing variables. The reason this is happening is I'm using PlayMaker to bind events, etc.. in a PlayMaker FSM State then getting rid of the binding/event after it's fired. This works great, but the problem is the function that is being delegated is being called for sequential states even though it was just bound. To fix this I need a way of knowing what Event just fired. Is there a method I can call do this? My PlayMaker action is as follows.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. namespace HutongGames.PlayMaker.Actions {
    5.     [ActionCategory("Coherent UI")]
    6.     public class CuiViewRegisterForEvent : FsmStateAction {
    7.         [ObjectType(typeof(CoherentUIView)), Tooltip("The View component. Not needed if View GameObject is used.")]
    8.         public FsmObject viewObject;
    9.         [Tooltip("GameObject reference to View. Not needed if View Object is used.")]
    10.         public FsmOwnerDefault viewGameObject;
    11.         [RequiredField]
    12.         public FsmString eventName;
    13.         [RequiredField]
    14.         public FsmEvent eventTriggered;
    15.  
    16.         private CoherentUIView view;
    17.         private Coherent.UI.BoundEventHandle handler;
    18.         private bool bound;
    19.  
    20.         public override void Reset() {
    21.             viewObject = new FsmObject { UseVariable = true };
    22.             viewGameObject = null;
    23.             eventName = new FsmString { UseVariable = true };
    24.             eventTriggered = null;
    25.         }
    26.  
    27.         public override void OnEnter() {
    28.             DoAction();
    29.         }
    30.  
    31.         void DoAction() {
    32.             if ( bound == false ) {
    33.                 bound = true;
    34.  
    35.                 if ( viewObject.Value == null ) {
    36.                     var go = Fsm.GetOwnerDefaultTarget( viewGameObject );
    37.    
    38.                     if ( go == null ) {
    39.                         return;
    40.                     }
    41.    
    42.                     view = go.GetComponent<CoherentUIView>();
    43.                 } else {
    44.                     view = viewObject.Value as CoherentUIView;
    45.                 }
    46.  
    47.                 if ( view == null ) {
    48.                     return;
    49.                 }
    50.  
    51.                 handler = view.View.RegisterForEvent( eventName.Value, (System.Action) EventTriggered );
    52.             }
    53.         }
    54.  
    55.         void EventTriggered() {
    56.             Debug.Log( bound );
    57.             Debug.Log( eventName.Value );
    58.             bound = false;
    59.  
    60.             view.View.UnregisterFromEvent( handler );
    61.  
    62.             if ( eventTriggered != null ) {
    63.                 Fsm.Event( eventTriggered );
    64.             }
    65.  
    66.             Finish();
    67.         }
    68.     }
    69. }
    70.  
    Now what is happening is the following.

    I click a menu item that fires "MenuOptions" event. On the "MenuOptions" FSM state it binds "OptionsBack". The problem is as soon as I click "MenuOptions" both "MenuOptions" and "OptionsBack" fire at the same time. This is because they're both using the delegate function "EventTriggered". If I can find what event fired though I can do a simple comparison and should be able to determine if it should continue or not based off that. What's weird is this only happens 1 time. Afterwards it continues to work fine.
     
    Last edited: Aug 18, 2013
  9. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Ok, seams to crash everytime I use UnregisterFromEvent. UnbindCall seams to be working fine. I'm sorry, but I can't provide my project; it is too near completion and am not comfortable sending source of my entire game.

    Edit: Yup, it's absolutely the PlayMaker usage of registering events. Seams there's some sort of cross-over happening. I'll need to know what event just fired to ensure subsequent registered events don't accidentally get called and unregistered prematurely. Any idea how to get the event name of the event just called?
     
    Last edited: Aug 18, 2013
  10. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Ok, I think I fixed my issue. I fire my next state event in PlayMaker and unregister the CoherentUI event on the next frame. This seams to resolve the crash and any further issues.
     
  11. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    there is no API in Coherent UI to get the name of the currently executing event.
    I am not accustomed to PlayMaker FSM bottle, so I don't understand why you can't understand which event has been fired.

    Although EventTriggered is a single delegate RegisterForEvent should return different handles for each registration so that you can unregister only a particular registration.

    I am glad you have found a workaround.
    Will still will try to recreate your flow and reproduce the issue, so the crash gets fixed too.
     
  12. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Ok, was able to completely resolve my issues. The crash was all my fault; needed to implement better unbind and unregister usage for my custom actions. Below is the revised action posted earlier, which is completely working fine again now for those curious.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. namespace HutongGames.PlayMaker.Actions {
    5.     [ActionCategory("Coherent UI")]
    6.     public class CuiViewRegisterForEvent : FsmStateAction {
    7.         [ObjectType(typeof(CoherentUIView)), Tooltip("The View component. Not needed if View GameObject is used.")]
    8.         public FsmObject viewObject;
    9.         [Tooltip("GameObject reference to View. Not needed if View Object is used.")]
    10.         public FsmOwnerDefault viewGameObject;
    11.         [RequiredField]
    12.         public FsmString eventName;
    13.         [RequiredField]
    14.         public FsmEvent eventTriggered;
    15.  
    16.         private CoherentUIView view;
    17.         private Coherent.UI.BoundEventHandle handler;
    18.         private bool bound;
    19.  
    20.         public override void Reset() {
    21.             viewObject = new FsmObject { UseVariable = true };
    22.             viewGameObject = null;
    23.             eventName = new FsmString { UseVariable = true };
    24.             eventTriggered = null;
    25.         }
    26.  
    27.         public override void OnEnter() {
    28.             if ( viewObject.Value == null ) {
    29.                 var go = Fsm.GetOwnerDefaultTarget( viewGameObject );
    30.  
    31.                 if ( go == null ) {
    32.                     return;
    33.                 }
    34.  
    35.                 view = go.GetComponent<CoherentUIView>();
    36.             } else {
    37.                 view = viewObject.Value as CoherentUIView;
    38.             }
    39.  
    40.             if ( view == null ) {
    41.                 return;
    42.             }
    43.  
    44.             if ( bound == true ) {
    45.                 view.View.UnregisterFromEvent( handler );
    46.  
    47.                 bound = false;
    48.             }
    49.  
    50.             handler = view.View.RegisterForEvent( eventName.Value, (System.Action) EventTriggered );
    51.  
    52.             bound = true;
    53.         }
    54.  
    55.         void EventTriggered() {
    56.             if ( eventTriggered != null ) {
    57.                 Fsm.Event( eventTriggered );
    58.             }
    59.  
    60.             Finish();
    61.         }
    62.     }
    63. }
    64.  
    The way states work in PlayMaker you could end up with duplicate bindings. This implementation avoids this entirely by unbinding the previous binding and rebinds to ensure the state can respond to the event.
     
  13. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Ok, there still seams to be an issue. Trying to use UnregisterFromEvent after an event has fired doesn't work. I need to get rid of the registration after the event has fired. However, if I try to do this it doesn't do anything. I end up with duplicate events being fired. Example workflows as follows.

    Register > Fire > Execute > Unregister > Register > Fire > Execute > Execute > Unregister

    Notice the double execute on the second register. If I unregister immediately after registering the event it gets rid of it, but I can't seam to get rid of it as soon as it has fired.
     
  14. Mr-Brent

    Mr-Brent

    Joined:
    Aug 20, 2013
    Posts:
    19
    I can't seem to get anything from the coui: protocol to load once I publish to iOS, but it works if I host the files on a remote server and link to that. Is there something I'm supposed to do to make sure the coui resources are included in the iOS build?
     
  15. nikxio

    nikxio

    Joined:
    Oct 30, 2012
    Posts:
    69
    There aren't any known issues about that. Make sure you've selected the root of your UI Resources folder using Edit / Project settings / Coherent UI / Select UI folder. This will allow the post processor to copy the needed files in the Data folder of your XCode project. You can verify that your resources are there with the Finder. When you compile the iOS app the resources should be in the .app/Data folder as well.

    You can try the MobileInput demo in a new project to check if it works for you. If you're still having trouble, please contact support@coherent-labs.com with detailed info and log files.
     
  16. nikxio

    nikxio

    Joined:
    Oct 30, 2012
    Posts:
    69
    Hi there,

    I've tried reproducing the problem but with no luck. I tried changing the Menu scene from the MenuAndHUD sample with the following:

    MenuScript.cs:
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Coherent.UI;
    4.  
    5. public class MenuScript : MonoBehaviour {
    6.    
    7.    
    8.     private CoherentUIView ViewComponent;
    9.     private BoundEventHandle m_TestEventHandle;
    10.     private bool m_IsRegistered = false;
    11.  
    12.     // Use this for initialization
    13.     void Start ()
    14.     {
    15.         ViewComponent = GetComponent<CoherentUIView>();
    16.         if (ViewComponent)
    17.         {
    18.             ViewComponent.OnReadyForBindings += this.RegisterBindings;
    19.         }
    20.    
    21.         ViewComponent.ReceivesInput = true;
    22.     }
    23.    
    24.     private void RegisterBindings(int frame, string url, bool isMain)
    25.     {
    26.         if (isMain)
    27.         {
    28.             var view = ViewComponent.View;
    29.             if (view != null)
    30.             {
    31.                 view.BindCall("NewGame", (System.Action)this.NewGame);
    32.                 view.BindCall("RegisterTest", (System.Action)this.RegisterTestEvent);
    33.             }
    34.         }
    35.     }
    36.    
    37.     private void RegisterTestEvent()
    38.     {
    39.         if (m_IsRegistered)
    40.         {
    41.             Debug.Log ("TestEvent is already registered!");
    42.             return;
    43.         }
    44.        
    45.         Debug.Log("Registering TestEvent...");
    46.         m_TestEventHandle = ViewComponent.View.RegisterForEvent("TestEvent", (System.Action)this.TestEvent);
    47.         m_IsRegistered = true;
    48.     }
    49.    
    50.     private void TestEvent()
    51.     {
    52.         Debug.Log("Unregistering TestEvent...");
    53.         ViewComponent.View.UnregisterFromEvent(m_TestEventHandle);
    54.         m_IsRegistered = false;
    55.     }
    56.    
    57.     private void NewGame()
    58.     {
    59.         this.StartCoroutine(LoadGameScene());
    60.     }
    61.    
    62.     IEnumerator LoadGameScene()
    63.     {
    64.         // Display a loading screen
    65.         var viewComponent = GetComponent<CoherentUIView>();
    66.         viewComponent.View.Load("coui://UIResources/MenuAndHUD/loading/loading.html");
    67.         // The game level is very simple and loads instantly;
    68.         // Add some artificial delay so we can display the loading screen.
    69.         yield return new WaitForSeconds(2.5f);
    70.        
    71.         // Load the game level
    72.         Application.LoadLevelAsync("game");
    73.     }
    74. }
    75.  
    menu.html:
    Code (csharp):
    1. <html>
    2. <head>
    3.     <title>Coherent UI Demo - menu</title>
    4.    
    5.     <!-- css -->
    6.     <link rel="stylesheet" href="css/menu.css" type="text/css" media="screen" />
    7.     <link rel='stylesheet' href='css/fonts.css' type='text/css'>
    8.     <!-- js -->
    9.     <script type="text/javascript" src="js/jquery/jquery-1.7.2.min.js"></script>
    10.     <script type="text/javascript" src="js/underscore/underscore-min.js"></script>
    11.     <script type="text/javascript" src="js/backbone/backbone-min.js"></script>
    12.  
    13.     <script type="text/javascript" src="js/coherent.js"></script>
    14.    
    15.     <script type="text/javascript">
    16.     var fadeTime = 2000;
    17.    
    18.     $(document).ready(function() {
    19.         $('#cuLogo').fadeIn(fadeTime, function(){
    20.             var menu = $('#menuBack');
    21.             $(menu).addClass('menuItemActive');
    22.  
    23.             var menuTexts = $('.menuText');
    24.             $(menuTexts).removeClass('menuTextInactive');
    25.             $(menuTexts).addClass('menuTextActive');
    26.         });
    27.     });                                  
    28.     </script>
    29. </head>
    30. <body>
    31.     <div id='cuLogo'>
    32.         <img src='img/Coherent UI - icon.png'/>
    33.     </div>
    34.     <div id="menu">
    35.         <div id='menuBack'>
    36.             <div id='newGameBack' class='menuItem'>
    37.                 <span id="newGame" class='menuText menuTextInactive' onclick='engine.call("NewGame");'>New Game</span>
    38.             </div>
    39.             <div id='optionsBack' class='menuItem'>
    40.                 <span id="options" class='menuText menuTextInactive' onclick='engine.call("RegisterTest");'>Register Evt</span>
    41.             </div>
    42.             <div id='dlcBack' class='menuItem'>
    43.                 <span id="dlc" class='menuText menuTextInactive' onclick='engine.trigger("TestEvent");'>Fire registered evt + unreg</span>
    44.             </div>
    45.             <div id='quitGameBack' class='menuItem'>
    46.                 <span id="quitGame" class='menuText menuTextInactive'>Quit Game</span>
    47.             </div>
    48.  
    49.         </div>
    50.     </div>
    51. </body>
    52. </html>
    53.  
    If I understood correctly, I should get the message "Unregistering TestEvent..." twice after I register the event, fire it, unregister and fire it again but it shows up only once. Could you try isolating the issue in a smaller project or give us any more information about your usage? You can also send us a sample project if you like to support@coherent-labs.com.
     
  17. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    I had the exact same problem but on Android, though iOS builds were fine. I never did solve it, but when I return to the GUI side of things I will go to town on trying to get Coherent to work and will contact the support address if necessary.
     
  18. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Aha, ok I got it working right with the following. At any rate I've changed all my usages to use BindCall as it doesn't seam to ever give me any problems. The below works fine in an empty scene so somehow its behavior in my actual game doesn't want to play too nice and causes a crash. I've no idea what to think at this point, but I'm just going to let it go as I don't think it's an issue with CoherentUI.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. namespace HutongGames.PlayMaker.Actions {
    5.     [ActionCategory("Coherent UI")]
    6.     public class CuiViewRegisterForEvent : FsmStateAction {
    7.         [ObjectType(typeof(CoherentUIView)), Tooltip("The View component. Not needed if View GameObject is used.")]
    8.         public FsmObject viewObject;
    9.         [Tooltip("GameObject reference to View. Not needed if View Object is used.")]
    10.         public FsmOwnerDefault viewGameObject;
    11.         [RequiredField]
    12.         public FsmString eventName;
    13.         [RequiredField]
    14.         public FsmEvent eventTriggered;
    15.  
    16.         private CoherentUIView view;
    17.         private Coherent.UI.BoundEventHandle handler;
    18.         private bool bound;
    19.  
    20.         public override void Reset() {
    21.             viewObject = new FsmObject { UseVariable = true };
    22.             viewGameObject = null;
    23.             eventName = new FsmString { UseVariable = true };
    24.             eventTriggered = null;
    25.         }
    26.  
    27.         public override void OnEnter() {
    28.             if ( viewObject.Value == null ) {
    29.                 var go = Fsm.GetOwnerDefaultTarget( viewGameObject );
    30.  
    31.                 if ( go == null ) {
    32.                     return;
    33.                 }
    34.  
    35.                 view = go.GetComponent<CoherentUIView>();
    36.             } else {
    37.                 view = viewObject.Value as CoherentUIView;
    38.             }
    39.  
    40.             if ( view == null ) {
    41.                 return;
    42.             }
    43.  
    44.             if ( bound ) {
    45.                 view.View.UnregisterFromEvent( handler );
    46.  
    47.                 bound = false;
    48.             }
    49.  
    50.             handler = view.View.RegisterForEvent( eventName.Value, (System.Action) EventTriggered );
    51.  
    52.             bound = true;
    53.         }
    54.  
    55.         public override void OnExit() {
    56.             if ( bound  ( view.View != null ) ) {
    57.                 view.View.UnregisterFromEvent( handler );
    58.  
    59.                 bound = false;
    60.             }
    61.         }
    62.  
    63.         void EventTriggered() {
    64.             view.View.UnregisterFromEvent( handler );
    65.            
    66.             bound = false;
    67.            
    68.             if ( eventTriggered != null ) {
    69.                 Fsm.Event( eventTriggered );
    70.             }
    71.  
    72.             Finish();
    73.         }
    74.     }
    75. }
    76.  
     
  19. Mr-Brent

    Mr-Brent

    Joined:
    Aug 20, 2013
    Posts:
    19
    Well it works now, but I can't be sure what fixed it. I switched from the trial to the actual Coherent Mobile, and I also changed the ui resources folder. I believe there might have been a capitalization issue, which my Mac didn't care about, but XCode did for copying the assets? Either way, it works great now. Thanks!
     
  20. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Post Processing effects are affecting my UI. I've Bloom and Camera Motion Blur setup on my camera, but it's causing my UI (my HUD) to have whites blown out as well as blur when the camera is moved. How do I stop Post Processing from affecting CoherentUI? For normal Unity GUI you can just exclude the layer the UI is on, but for Coherent UI it doesn't have a layer and is added directly to the camera and excluding the camera layer doesn't seam to work other then make it some giant weird blurred mess.

    Edit: Nevermind. I feel stupid. There's an option to tell it to draw after post processing effects, lol. False alarm!
     
    Last edited: Aug 31, 2013
  21. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    374
    Found a bug in your latest version of CoherentUI v1.5.1:

    CoherentUISystem.cs line 708:
    Code (csharp):
    1. InputManager.GenerateMouseMoveEvent(ref m_MouseMoveEvent);
    For whatever reason this line of code isn't looking in your Coherent.UI namespace for the InputManager class and was instead trying to reference our own InputManager class in our project. Simple work around in place as below, but please resolve in your next version.

    Code (csharp):
    1. Coherent.UI.InputManager.GenerateMouseMoveEvent(ref m_MouseMoveEvent);
     
  22. nikxio

    nikxio

    Joined:
    Oct 30, 2012
    Posts:
    69
    Thanks for the report. We will update the scripts for the next release and check for other classes that might cause name collisions.
     
  23. 60days

    60days

    Joined:
    Jan 27, 2012
    Posts:
    23
    I'm encountering a bug with the lighting in CoherentUI pro (on PC, but planning cross-platform) - I've uploaded an example here: https://www.dropbox.com/s/uq26zhwzauom0vd/CoherentBug.unitypackage

    One camera renders the UI, the other renders objects (using transparentFX layer in this case as an example). If you run the scene as-is, the light does not work and the UI panel is dark. However if you remove the editor-assigned camera from the FillScreenQuad script, the lighting works. That script does not change any camera settings, it only reads the camera FOV and position.

    Ideally I would like to avoid the need for extra lighting passes altogether and use unlit/transparent almost always with UI, but that results in a crash.

    Additionally - if I purchased off the site, how do I now upgrade? There are no download links on the site and the Unity Asset Store doesn't show me as owning the license.
     
  24. gridside

    gridside

    Joined:
    Jul 26, 2013
    Posts:
    97
    Just WOW. This thing is looks amazing!
     
  25. adam_sgil

    adam_sgil

    Joined:
    Jan 23, 2013
    Posts:
    5
    Inconsistent showing / hiding between platforms

    I'm using CoherentUI 1.5 trial.
    I'm basing off the WebGUI example (fullscreen view).
    Initially the CoherentUIView is set for Show = false
    When I set View.Show = true at runtime it works on IOS / Android but not on Standalone/Editor where Show seems to be ignored and I have to View.enabled = false/true for this.
    View.enabled = false/true works on Standalone/Editor but if I try on mobile I don't see the view when I enable it.
     
  26. ianjgrant

    ianjgrant

    Joined:
    Mar 11, 2013
    Posts:
    28
    Hi, Just looking at the samples:

    How would I override the default material shader type of CoherentMaterialRTT0? It defaults as 'Diffuse' and I require, for example, 'Unlit' -no need for shading or shadows.

    From the manual:
    "When placing [CoherentUIView] on an object all the needed components are automatically created, hidden from you, and the rendered output is bound to the mainTexture of a new material that is created at runtime. This material is set as the gameObject’s renderer material so that you see the page rendered on your object."

    I've looked through the scripts but can't see where the shader gets created and assigned.

    Kind regards, Ian
     
  27. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    374
    We we please get a 32bit Linux lib built ASAP? We're currently running into bugs on the Unity Linux x64 Player and we cannot move forward without a 32bit Coherent lib.
     
  28. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    We'll examine the project and get back to you on that.

    About the update version - our client portal is being developed at the moment. We have send you an email with the newer version, if you haven't received
    it please emails us at support@coherent-labs.com.
     
  29. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    What kind of bugs you are experiencing with the Unity Linux x64 Player? Are they related to Coherent UI or not?
    At the moment we don't have 32bit libraries for Linux, because some of our third party libraries are not trivial to get running on 32 bit Linux.
    Please email us at support@coherent-labs.com, so we can discuss the issues you are having and possible solutions.
     
  30. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,
    It looks that we have missed that. It will be fixed in one of the next releases.
     
    Last edited: Sep 5, 2013
  31. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    We will think how to expose this property to the inspector.
    At the moment to change the shader you'll need to edit our Assets/Standard Assets/Scripts/CoherentUI/Detail/ViewListener.cs,
    line 86.
    Code (csharp):
    1.  
    2. shader = Shader.Find(m_ViewComponent.IsTransparent ? "Transparent/Diffuse" : "Diffuse");
    3.  
    Please let me know how that works for you.
     
  32. ianjgrant

    ianjgrant

    Joined:
    Mar 11, 2013
    Posts:
    28
    That worked nicely thank you.

    I changed line 86 to:

    Code (csharp):
    1. shader = Shader.Find(m_ViewComponent.IsTransparent ? "Unlit/Transparent" : "Unlit");
    When I said I'd looked through the scripts - obviously it seems not all of them!

    I have a couple of other (maybe basic) questions to ask - I'll separate them out into a new thread.

    Kind regards, Ian
     
  33. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,
    We are having some issues with the unity package you linked. It is either incomplete or we need some instructions how to use it.
    If the package is incomplete and you have to send a significant part of your project, consider emailing us at support@coherent-labs.com
     
  34. M_Plot

    M_Plot

    Joined:
    May 30, 2013
    Posts:
    3
  35. Darkoo

    Darkoo

    Joined:
    Feb 4, 2013
    Posts:
    96
    When developing for mobile what JavaScript libraries do you recommend regarding touch events if this is even nessesary, if so are there any that can handle both mouse and touch events at the same time?
     
  36. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Hi
    I would like to ask about this tool.... I'am making app with a lot of different articles. I would like to render this articles from html using NGUI but it's not so easy. I thought that I can use this tool, build this app using for example sencha animator ( it's couple panels moving around, and zooming in/out) and store my articles as html files. Is a good idea ? I'am not good at Java script and I don't know html , but opportunity of using tools like sencha animator sounds great. Did someone use any third party tool like sencha twith Coherent UI ?
    My app is for ios.
     
  37. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    What is the easiest way to render web page using UIView and receive Input touch on ios device ?

    Ok Got It:
    Input State : Take All
     
    Last edited: Sep 12, 2013
  38. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Is it possible to use this with NGUI ?
     
  39. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi, it depends on the plugin that is playing the SMIL file. Some plugins like Flash work offscreen and therefore are usable in Coherent UI, some
    actually render a screen on top of the browser and they won't work.
     
  40. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Yes, it is possible. We are preparing a sample for that.
    You can place the view on a texture and give NGUI to use it on the desktop platforms.

    For iOS it is still possible as long as NGUI is drawn on the screen - place the view on a texture with appropriate X, Y, width and height so that it fills
    the hole in NGUI.
     
  41. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    As far as I know JQuery Mobile implements clicks in a way that is fastest for platform - without the 200ms delay for generating click on mobile platforms.
    Here is a some info about that:
    https://coderwall.com/p/bdxjzg
     
  42. Darkoo

    Darkoo

    Joined:
    Feb 4, 2013
    Posts:
    96
    Thanks for the answer!!

    For those that wonder the same, found a plugin for jQuery called Hammer.js that takes care of multitouch events for mobile/smartphones and that also at the same time takes care of desktop events too.

    BTW Coherent,
    Your new website is great much better than the one before! and also I wish Unity used your GUI solution in some way in their "the new GUI" instead of NGUI!!
     
  43. orca6

    orca6

    Joined:
    Jun 13, 2013
    Posts:
    9
    I am new to Unity and trying to use the Coherent UI for my project.
    I have my own pointing device like Kinect other than Mouse.
    Using the device, I can get the position of the pointing device
    in X and Y coordination same as Mouse,
    and also get the event which is for the mouse up and down click event.

    How do I pass the event and the position information to Coherent UI?
    (Which Coherent UI's API should I use for the mouse event?)

    Thanks!
     
  44. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,

    you can checkout the Game scene from our MenuAndHUD sample.
    The ObjectPicker script sends the mouse events to the view using the viewComponent.ReceivesInput property
    and viewComponent.SetMousePosition method.
     
  45. orca6

    orca6

    Joined:
    Jun 13, 2013
    Posts:
    9

    DimitarT, thank you very much for your reply.
    I tried to test by the following very simple test program which tells the mouse position to Coherent UI.

    void Update () {
    . some declare statements...
    . some other codes...

    hitInfo = GameObject.Find("/cube-textures/back_face");

    CoherentUIView viewComponent = hitInfo.collider.gameObject.GetComponent(typeof(CoherentUIView)) as CoherentUIView;

    viewComponent.ReceivesInput = true;
    viewComponent.SetMousePosition(
    (int)(point.x),
    (int)(point.y));
    .
    }

    The above code is basically from Sample01_HelloCoherentUI. The "back_face" of "cube-textures" has "CoherentUIView.cs".
    And the "back_face" is as big as the screen size, so I coded "hitInfo = GameObject.Find("/cube-textures/back_face");" as the test program.

    I am afraid the above code doesn't work. Am I missing anything?
    And how do I send the mouse event type (MouseUp/MouseDown)?

    I have one more question. How can I directly call JavaScript function in the HTML5 page that is displayed by Coherent UI?

    Thanks!
     
  46. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi,
    I don't see the point initialization above, but it should be
    new Vector2(hitInfo.textureCoord.x * viewComponent.Width, hitInfo.textureCoord.y * viewComponent.Height);

    To create a mouse event use
    Code (csharp):
    1.  
    2. var mouseEvent = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
    3. mouseEvent.Type = MouseEventData.EventType.MouseUp;
    4. view.MouseEvent(mouseEvent);
    5.  
    The entire input handling is in CoherentUISystem.OnGUI method.


    To directly call JavaScript function you can use Coherent.UI.View.ExecuteScript method or
    you can also create a stub that allows to call any global function with arguments

    Code (csharp):
    1.  
    2. function callGlobal(name) {
    3.     var arguments = Array.prototype.slice.call(arguments, 1);
    4.     window[name].call(null, arguments);
    5. }
    6.  
    7. engine.on("callGlobal",callGlobal);
    8.  
    9. myLog = console.log.bind(console);
    10.  
    11.  
    After that you can do in .Net

    Code (csharp):
    1.  
    2. View.TriggerEvent("callGlobal", "myLog", "the answer is", 42);
    3.  
     
  47. orca6

    orca6

    Joined:
    Jun 13, 2013
    Posts:
    9

    Thank you very much for your quik reply!
    I have a quick question for the above mouse event creation. I have "viewComponent" object as you see the above my code. So I wrote...

    viewComponent.MouseEvent(mouseEvent);

    But, I got the following error.

    Assets/Standard Assets/ImagePlayback.cs(261,47): error CS1061: Type `CoherentUIView' does not contain a definition for `MouseEvent' and no extension method `MouseEvent' of type `CoherentUIView' could be found (are you missing a using directive or an assembly reference?)

    Which object shall I use to create the mouse event?

    BTW, is there any documentation?

    Thank you!
     
  48. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99
    Hi

    The "MouseEvent" method is a method of Coherent.UI.View;

    You can access it by viewComponent.View.MouseEvent

    The documentation is in Assets\CoherentUI\doc
     
  49. orca6

    orca6

    Joined:
    Jun 13, 2013
    Posts:
    9
    Thank you for your reply!
    I got the following error...

    The line 260 of ImagePlayback is ...

    The codes are in Update(), so I think "Event.current" is NULL.
    How do I create "Event.current"?

    Thank you!
     
  50. DimitarT

    DimitarT

    Joined:
    Apr 8, 2013
    Posts:
    99