Skip to main content
1 of 3
Anon
  • 31
  • 3
  • 11

Unity Destroy Unused GameObjects

I'm trying to access a method in another script without using the keyword "static";

public void CreateFarm()
{
    new Farm().NewResourceBuilding(gameObject);
}

My question is; will Unity automatically delete this object once it's done calling the method? Or will I need to manually destroy it? If the latter, how will I go about that?

I've searched on Google and been on this problem for a few days until I've finally come to this solution lol. So annoying to reference a static yet want to add a gameobject via the inspector.

Anon
  • 31
  • 3
  • 11