hi guys I’m very new to unity and C# and I’m having what I’m sure is a simple scoping issue and would like some advice.
this is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
public GameObject Map;
public GameObject MapPinPrefab;
private class Thing
{
Vector3 location;
GameObject mapPin;
public Thing(Vector3 l)
{
location = l;
CreateMapPin();
}
public void CreateMapPin()
{
mapPin = Instantiate(MapPinPrefab, location, Quaternion.identity);
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
that gives this error
Error CS0120 An object reference is required for the non-static field, method, or property ‘Example.MapPinPrefab’ Example.cs 23
so i get that in my instantiate call MapPinPrefab must not be in scope but i don’t understand why or how to get a global in scope here.
i realize I’m probably being very dumb but any help/advise would be appreciated