Search Unity

Animation on main camera

Discussion in 'Animation' started by SirMarley, Jul 26, 2014.

  1. SirMarley

    SirMarley

    Joined:
    Jul 26, 2014
    Posts:
    115
    Hi there,

    I am pretty new to Unity so I have no idea if this is possible and if so, how can be done, but I have a script on my main camera, so the background resize depending on the device where it is played, then I have manually attached the background texture to this (it is a new component in the inspector of the main camera) and I have an animation based on the background, but I do not know how to make it play.

    I mean: if I have the .jpeg as a hierarchy game object and I click on play with nothing else, the animation will play but the images are not going to resize. But, if I add the script to the main camera and I add the jpeg as my BG texture, the pic will resize but the anim won´t play.

    Is there anyway to make both?

    (here is the script I have:

    using UnityEngine;
    using System.Collections;

    public class Presentation : MonoBehaviour {

    public Texture msTexture;

    void OnGUI(){
    GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), msTexture);
    }
    }

    Thanks!!!