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

Instantiate Null error

$
0
0
The error says "ArgumentException: The Object you want to instantiate is null. UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:383) UnityEngine.Object.Instantiate[T] (T original) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:274) GameManager.Start () (at Assets/GameManager.cs:19)" The code Im using is: `using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : MonoBehaviour { public Ball ball; public Paddle paddle; public static Vector2 bottomLeft; public static Vector2 topRight; // Start is called before the first frame update void Start() { bottomLeft = Camera.main.ScreenToWorldPoint (new Vector2 (0, 0)); topRight = Camera.main.ScreenToWorldPoint (new Vector2 (Screen.width, Screen.height)); Instantiate (ball); Paddle paddle1 = Instantiate (paddle) as Paddle; Paddle paddle2 = Instantiate (paddle) as Paddle; paddle1.Init (true); // Right paddle2.Init (false); // Left } } `

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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