Jump to content

Recommended Posts

Greetings,

 

Long story short:  I've seen mods that spawn a prefab in an AddPrefabPostInit like so:

AddPrefabPostInit("forest", function(inst)    print("*** Spawning a thing")    myprefab = GLOBAL.SpawnPrefab("myprefab")end)

This gets called every time one loads a save game.  So, what keeps this from accumulating multiple "myprefabs" as the player saves, exits, and reloads?  Is there something special about this phase that prevents spawned prefabs from being saved, or is there something about the prefab itself that necessitates it being recreated every time a map is loaded or created?

Edited by blahpers
Link to comment
https://forums.kleientertainment.com/forums/topic/55353-prefab-persistence/
Share on other sites

For starters, this prefab would always end up at 0/0 in the world. I assume that prefab is some kind of dummy and not persistant, because else it would make a new one everytime, as you said.

 

Can you please show me a mod that does this? Your sample is rather confusing (and syntactically incorrect).

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
×
  • Create New...