i wrote to you on the email yesterday, but we didn't understand each other due to terminology differences. I checked the forums, but i haven't found the solution, but the problem is pretty straightforward, so i hope you can help.
Anyway, here's what's going on.
I created a spawner that churns out prefab Enemy and that's working fine. Also, the hitpoint feature on Killable script is working fine and the Enemy gets despawned or not depending on the Bullet's attack points.
The thing that i can't make to work is to destroy the Bullet on collision with the Enemy.
I've added the Killable script on the Bullet prefab, but when i hit play it says that it is despawned and inactive. I get that, it wasn't spawned through the CGK spawner, but how come can i alter the Bullet's attack points and they affect the enemy accordingly? And if the Bullet affects the Enemy, how come doesn't the Enemy affects the Bullet?
I've tried setting the HP Death Mode on the Bullet prefab to Collision or Trigger - nothing happens.
Also, when i make an FSM for the Bullet prefab to destroy itself on collision then the Enemy gets despawned by one shot, no matter how high i set the hitpoints.
Edit: i snooped around the forum a bit, took a look at some of the other topics, i will try to spawn Bullet through Spawner.
You're going to have to send me a project that reproduces the problem. Please see the official bug reporting thread stickied here.
Or, turn on logging for the bullet Killable and it will probably tell you what's wrong in the console. It's not required to use spawners by the way. Again, there's no point trying to solve the problem with Playmaker. It will fail for the same reason, whatever it is.
Ok, i've made a simple project without playmaker, basic stuff, scripts for moving the Player and Enemy, Shot script for the Bullet and Weapon script for shooting, added the Enemy and Bullet prefabs to the pool etc.
And the problem remains. The Enemy reacts great to the Bullet, if it has HP of 2, it takes two shots to despawn it. Unfortunately, the Bullet does not despawn by collision.
The thing is, when i put the Bullet in the scene, everything works as it should, it hits the Enemy, both despawn. But when i fire (instantiate the shot via weapon script) it acts differently, i.e. does not despawn. However, i noticed that the instantiated Bullet is CLONE, and is not considered as being from the pool since i get the following message in the console: The Transform 'Shot(Clone)' passed to Despawn is not in Pool Boss. Not despawning.
Aha. The problem is that you're Instantiating the bullet. You should never Instantiate *anything* that is Killable or that spawns from spawners when using Core GameKit. You should only spawn and despawn via PoolBoss. Everything depends on PoolBoss. So, make sure you have put the "Shot" prefab in PoolBoss, then call PoolBoss.Spawn instead of Instantiate (which is many many times better for performance). That will be working now.
Whether Instantiating or Spawning, the word Clone will be on there, but the spacing will be slightly different. That's normal.
Another day, another challenge! I hope it's ok to post it here, i don't want to clutter the forum with topics.
Not sure if this is the right place to post the problem, since it involves Playmaker, but it also involves one of your actions. I posted the same thing on the Playmaker forum, here it goes here too:
On the first picture we have a very simple FSM attached to the Player object. I am using actions from Core Game Kit for pooling objects. In this case, by pressing key, a shot is spawned from the spawner object attached to the player object, and whenever the player moves, the bullet spawner moves with him. I just dragged and dropped the bullet spawner from the scene to the "other object for position" box, and everything works fine.
In the next picture, i am doing something similar for the Enemy object, but something's not working right. I created the Enemy, spawner object for him to shoot from, and simple FSM to spawn bullets every second. Here comes the problem, i can't drag and drop the spawner object from the scene directly into the "other object For Position" box (i get the menu in the picture with options to get or set property), only from the prefab folder, but then the bullets are spawned right in the middle of the screen, not from the spawning object attached to the enemy object.
Here's another picture to better show you what's going on:
Yeah that's a limitation of Unity. It won't allow you to use another object in the Scene for that, so the get/set pops up. You will be able to use another game object in the same prefab but not anything else.
However, there's another way to do this. Don't make a bullet spawner prefab. Just add a Triggered Spawner component to the enemy (and to the player), and call its method "ActivateCodeTriggeredEvent1" after setting up a wave for CodeTriggeredEvent 1 on it. Playmaker can call that method.
Post by DarkTonic Dev on Feb 19, 2016 16:23:53 GMT
If you took a screen shot from Play mode, then there's no way it's going to work since your player is despawned (that's why the red message).
Anyway, you still need to drag the TriggeredSpawner component into the "Behaviour" box above where you typed ActivateCodeTriggeredEvent. Otherwise, Playmaker doesn't know what C# class to call the method on. That's why it says "Behaviour is invalid!".
Sorry, it wasn't in the play mode, it's spawned. Yeah i know, the trouble is i get the get/set popup when i drag the script over. I'll check out playmaker forums once more, there's been talk of the problem when FSM is loaded from template, i have to make sure that is solved.