mask Layer ?

Hi,

I would like to know if is it possible to create an invisible mask layer for my gui?

I’m doing a script to have a mini map, like GTA San Andreas (but without the automatic zoom in zoom out), so the player don’t move, just the map.

How can i do to hide a part of my GUI ?

Thank’s for your help.

BooBi

Ok, I found these shaders from previous threads.
And for my camera I don’t want to use a render to texture, i’m using a logic close to the radars on wiki.

When the player move forwards, the minimap do a translation backwards with the (same amout to move * Scaling)etc.

But is iT possible to use a material in my GUI?
Or export the result of my shader to a texture and use this texture in my GUI ?

http://forum.unity3d.com/viewtopic.php?t=29835

Shader "MaskedTexture"
{
   Properties
   {
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Mask ("Culling Mask", 2D) = "white" {}
      _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
   }
   SubShader
   {
      Tags {"Queue"="Transparent"}
      ZWrite Off
      Blend SrcAlpha OneMinusSrcAlpha
      AlphaTest GEqual [_Cutoff]
      Pass
      {
         SetTexture [_Mask] {combine texture}
         SetTexture [_MainTex] {combine texture, previous}
      }
   }
}

[/url]

As said in the link you’ve posted, gui elements aren’t GameObjects and cannot have a material.

There is way to do what you want without rendering to a rendertexture :slight_smile:

  1. Create a plane, assign a new Layer for it, for example ‘UI’, this will be your radar
  2. Create a new camera in the scene (call it for example UICamera), set it to be Orthographic, set Depth to 1 and Culling Mask to UI (this means that UI Camera will draw GameObjects which have UI Layer) and Clear Flags - Depth Only.
    You should have now two cameras - MainCamera and UICamera, also don’t forget to unselect UI Layer in MainCamera’s Culling Mask
  3. Position radar plane to be in front of the UI Camera
  4. Assign your handy material to that plane
  5. And there you go, you have a gui which can have your own created material, and no matter how you move MainCamera, your radar will always be in front, because UICamera won’t move

Hope that helps

Hi,

Thank’s a lot,

but i found a solution to my problem, last night. Now it’s working !

Would you mind sharing the solution? I also have a smiliar problem now and cant find a solution in the forums.