YouGroove Posted March 18, 2013 Share Posted March 18, 2013 I would like to have some spawning object. It would spwan a goblin each time , when the player destroy one, it would spawn a new one. And it would stop spawning when it has reached to spwan for example 5 Goblins. I know how to load a model by code, but how to make it run with "animation manager" and "goblin" scripts ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 18, 2013 Share Posted March 18, 2013 Instead of loading a model, you can load a prefab which contains animation. In another topic however, Rick seems to have found a bug where the scripts are executed when loading a prefab. Something which should happen. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 18, 2013 Author Share Posted March 18, 2013 There is no way o say : Load this model. Than call This list of scripts on it ? like script names with relative folders ? Nevermind i have a solution : Spawner script contains functions to manage the goblin AI , animations etc ... But i think it must exist a solution ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted March 18, 2013 Share Posted March 18, 2013 What spawner script are you looking at? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 18, 2013 Author Share Posted March 18, 2013 lol No i will make it. I found a solution is to have the code that manages the goblin simply in the spawner. The spawner will just call functions it has on the goblin, and will manage the load and destroy of goblins. I just thaught it was some way to load a model like Goblin and attach a script to it by code. Like this we could have some general Spawner that could spawn goblins or other stuff , scripts to call and mesh name would just be parameters in the panel. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted March 18, 2013 Share Posted March 18, 2013 Yeah, prefabs are supposed to do that and Prefab:Load() will load a new instance. However, I'm finding that it doesn't seem to be running the scripts (even though I told it to load the scripts as well in the second param to the Load function). I'm working on a PrefabFactory that you pass in a prefab file and it'll create an instance of whatever you pass in (like a goblin). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.