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

OnMouseDown Problem when using Target Texture

Discussion in 'Scripting' started by Hummelwalker, Jan 17, 2012.

  1. Hummelwalker

    Hummelwalker

    Joined:
    Oct 28, 2010
    Posts:
    119
    Hi,

    I have simple scene: a small script (see below), a cube, a plan, two cameras and a rendering texture.

    UPDATE: Here you can download a small test scene.

    In that scene I use the plan as an ingame screen by setting the rendering texture as the target texture of the second camera and using a material with the rendering texture as the plan material.

    Then I add my script to the cube.

    The script includes only this function:

    Code (csharp):
    1. void OnMouseDown()
    2. {  
    3.     Debug.Log(gameObject.name);
    4. }
    When I start the scene everything looks good. But when I click on the cube, nothing happend. When I deactivate the second camera everything works. :(

    My current camera settings:
    Main Camera: tag maincamere, depth -1
    second camera: tag untagged, depth 1

    When I use the second camera as a normal camera (for displaying other layers etc.), my script works. But when I use a rendering texture as a target texture it doesn't...

    Any ideas?
     
    Last edited: Jan 18, 2012
  2. Hummelwalker

    Hummelwalker

    Joined:
    Oct 28, 2010
    Posts:
    119
    Has anybody an idea or does nobody have that problem?
     
  3. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    Post ur project if it small, may be i can help u
     
  4. Hummelwalker

    Hummelwalker

    Joined:
    Oct 28, 2010
    Posts:
    119
  5. ninjabit

    ninjabit

    Joined:
    Oct 2, 2013
    Posts:
    2
    Any progress on this? I am having the same problem.