Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Cant Add Script - "Can't add script behaviour VisualContainerAsset",Can't Add Script "The script needs to derive from MonoBehaviour!"

$
0
0
I wrote this script in Visual Studio, opened by default from Unity. When trying to apply it to my background object I get the following message, "Can't add script behaviour VisualContainerAsset. The script needs to derive from MonoBehaviour!" What am I missing here? My Script: public class TiledBackground : MonoBehaviour { public int textureSize = 32; // Use this for initialization void Start () { var newWidth = Mathf.Ceil (Screen.width / (textureSize * PixelPerfectCamera.scale)); var newHeight = Mathf.Ceil (Screen.height / (textureSize * PixelPerfectCamera.scale)); transform.localScale = new Vector3 (newWidth * textureSize, newHeight * textureSize, 1); GetComponent ().material.mainTextureScale = new Vector3 (newWidth, newHeight, 1); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>