2.9.16
Coherent GT Unity3D Guide
A modern user interface library for games
Coherent GT Components

Creating a Coherent GT view

Coherent GT View is added to the scene just like a regular Component in Unity3D:

  1. In the Unity3D Editor, via attaching the Coherent GT View component to an existing Game Object.
  2. Programatically, by calling AddComponent on the desired Game Object.

All the views are managed by a Coherent.UIGT.UISystem (wrapped in a Coherent GT System). By default, if there's no user-created Coherent GT System present, at the time when a Coherent GT View is created, a default Coherent GT System is added automatically to the scene.

If you want your Views to use a non-default UISystem you should, simply add a Coherent GT System component in your scene with the desired settings.

Note
You can have only one Coherent GT System. If you try to create more than one, the creation of every system but the first, will fail.

Coherent GT View properties

General section:

  • URL - Indicates the URL that will be initially loaded.
  • Width - The width of the Coherent GT View.
  • Height - The height of the Coherent GT View.
  • AudioSource - The audio source for this View. Audio from the page is send to this AudioSource. If no audio source is selected, a default one will be. created and attached to the same game object.
  • Auto Refresh - When this is ticked, the view will monitor for changes in the loaded page and will reload it automatically upon change.
  • IsAudio3D - This is visible only in Unity 4.x. It is indicating whether the sound from the view should be 3D or 2D. In Unity 5.x this is controlled by the Audio Source component. By default the sound is 2D.

Rendering section:

  • Post Effect - Defines whether the View is drawn. before or after the post-effects. Available only for Views attached to cameras.
  • Flip Y - Flips the drawn image vertically.
  • Is transparent - Defines if the View supports transparency.
  • Match camera size - The View will be automatically resized to always match the size of the camera.
  • Click-through threshold - A value in the range [0-1] inclusive that determines whether a pixel is transparent. A pixel is transparent if its alpha value is below or equal to the threshold.

Advanced rendering section:

  • Always on top - Indicates whether this value is z-buffer independent. If it is set to true, the view is rendered on top of everything.
  • Texture format - This refers to the color space conversion mode of the RenderTexture used to display the view. You can read more about it in Unity3D documentation

Input section:

  • Lockable focus - When enabled, the View takes the input focus when clicked and releases it when you click outside the View. See Click to focus Views

Scripting section:

  • Pre-load script - The script will be executed before any other code in the UI View.
  • Auto UI messages - When enabled, any event triggered in JavaScript on the engine object is forwarded to the game object containing the View.
  • Enable [CoherentMethodAttribute] - Enables the usage of the [Coherent Method attribute]. (CoherentMethodAttribute)

Coherent GT System properties

General section:

  • Debugger port - The port where the system will listen for the debugger. Invalid values disable the debugger.
  • Disk Cache size - The maximum size of the disk cache.
  • Run Asynchronously - Enables the asynchronous mode. See Asynchronous mode
  • Enable Localization - Enables localization for all views. Keep that unticked when not using localization for better performance. See Localization

Coherent Live Game View properties

General section:

  • Name - The name of the Live View - must be the same as in the HTML page.
  • Width - Width of the Live View.
  • Height - Height of the Live View.
  • Target View - The Coherent GT View displaying the HTML page with this Live View name.
  • Source Camera - The camera used as source for this live view. By default the component will use the camera on the same gameobject.
  • Source Texture - A RenderTexture used as source.

You can supply either Camera or a Texture as source.