Hey,

I’m working on a turn based combat system. The idea is nothing new you walk along and touch an enemy’s collider which triggers the battle arena (-> new scene). Now I am wondering how can I tell which enemy to instantiate inside the new scene based on the enemy I collided with. Right now I’m thinking about creating an specific “empty” gameobject (based on the enenmy I collided) that isn’t destoryed on load and somehow check for it in the new battle scene and then decide which enemy should be created based on this “empty” gameobject.

But I don’t really know how I could do this and got the feeling that it is probably a stupid idea and that there is a much better way to go for it, since this must be some very common thing to do for role based combat rpgs. I didn’t find anything and would be thankful for pointers/ideas/concepts on how to do this (if you want to post script c# would be most useful/understandable).

Thanks a lot.

“Right now I’m thinking about creating an specific “empty” gameobject (based on the enenmy I collided) that isn’t destoryed on load and somehow check for it in the new battle scene and then decide which enemy should be created based on this “empty” gameobject.”

This isn’t a bad idea.

If you want data to persist between scenes, the easy way to do it is to make a manager that’s set to http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html

Then, when you collide with an enemy and you transition between scenes… you can tell that manager important data… like which units to spawn for the enemy, and where on the world map you were when the fight started so you can place the player back in the same spot when the fight is over…

And all sorts of other stuff.