Jump to content

Checking the Existence of Prefabs


Recommended Posts

Hi so I discovered that, by the time the game loads the modmain, GLOBAL.PrefabExists to any prefab returns false, as they have not been loaded yet. I have been using GLOBAL.AllReciples[prefab] to check but it only covers craftables. What is the there better way to confirm the existence of certain prefabs?

Link to comment
Share on other sites

2 minutes ago, Bad Willow said:

Hi so I discovered that, by the time the game loads the modmain, GLOBAL.PrefabExists to any prefab returns false, as they have not been loaded yet. I have been using GLOBAL.AllReciples[prefab] to check but it only covers craftables. What is the there better way to confirm the existence of certain prefabs?

You can do a AddSimPostInit, when the game runs this postinit all prefabs in the game should have been loaded in by now.
 

AddSimPostInit(function()
	--All prefabs are loaded in now
end)

 

Edited by Hornete
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...