Search Unity

Make a game object attach to the main camera when the player touch it.

Discussion in 'Scripting' started by Crispychicken888, Sep 13, 2012.

  1. Crispychicken888

    Crispychicken888

    Joined:
    Sep 12, 2012
    Posts:
    1
    I'm new to Unity and i am making an "Exploration game".

    I have maked a cube that looks that a flashlight and i attached the Spotlight to the cube.
    What i want to do is make the spotlight attach to the players main camera when the player
    touch the cube.

    Thanks.
     
  2. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    Instead of having to use the same model you can simply turn off the model in the level and turn on a model you have already attached to the camera. This allows you to have a different model for each situation, add animation to the action and not to mention it's just simpler to code and will have less bugs.