refrence a script

so don’t call me a dum dum I am new to unity and I love to code. but you (you know who you are) are just mean so stop I have bad speling ok.

erors:
Assets\scripts\triger.cs(12,15): error CS1061: ‘object’ does not contain a definition for ‘GetComponent’ and no accessible extension method ‘GetComponent’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class triger : MonoBehaviour
{
    moveCam moveCam;
    public object thing;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        thing.GetComponent(moveCam).enabled = false;


    }
}

I am trying to refrens the thnig plz help

You probably want to use GameObject there. Not object.

Also if you want to have somewhat readable code, check your spelling! :wink:

thx bro
but now I have a new error:
Assets\scripts\triger.cs(12,28): error CS1503: Argument 1: cannot convert from ‘moveCam’ to ‘System.Type’

I think you will be better off to follow some basic tutorials.
C# basics:

Unity basics:

1 Like