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

how to fix unexpected symbol 'MonsterPrefab' error CS1525 for a tower survival game

$
0
0
I tried using this code in c sharp script but could not get the script to work. It always kept saying ,"Assets/PlaceMonster.cs(8,52): error CS1525: Unexpected symbol 'MonsterPrefab', expecting '(',')',',',';','[','{', or '' using UnityEngine; using System.Collections; public class PlaceMonster : MonoBehaviour { // Use this for initialization void Start () { new GameObject MonsterPrefab; new GameObject Monster; private bool canPlaceMonster () { return Monster == null; } //1s void OnMouseUp () { //2 if (canPlaceMonster ()) { //3 Monster = (GameObject) Instantiate (MonsterPrefab, transform.position, Quaternion.identity); //4 AudioSource audioSource = gameObject.GetComponent (); audioSource.PlayOneShot (audioSource.clip); // TODO: Deduct gold } } } } Please help

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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