- error CS0103: The name ‘gameobject’ does not exist in the current context
- error CS0103: The name ‘instantiate’ does not exist in the current context
i dont get what im doing wrong ??
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PipeUp : MonoBehaviour
{
private Character character;
public GameObject pipeDown;
// Use this for initialization
void Start()
{
character = FindObjectOfType<Character>();
}
// Update is called once per frame
void Update()
{
if (character.transform.position.x - transform.position.x > 30)
{
float xRan = Random.Range(0, 10);
float yRan = Random.Range(-5, 5);
float gapRan = Random.Range(0, 3);
instantiate(gameobject, new Vector2(character.transform.position.x + 30 + xRan, -11 + yRan), transform.rotation);
instantiate(pipeDown, new Vector2(character.transform.position.x + 30 + xRan, 12 + gapRan + yRan), transform.rotation);
Destroy(gameObject);
}
}
void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.tag == "Player")
{
character.Death();
}
}
}