|
Post by starfoxy on Sept 21, 2017 5:29:24 GMT
Hello, I have a strange issue with this combination.
I have everything set up with the syncro spawner and it is working fine.
I have attached a dotween component to my prefab that is being spawned (a simple movement).
If I run this by using auto-add missing items for poolboss, it all works great. My prefab spawns and begins/completes it's dotween movement animation.
I tried however, to setup a category in poolboss and when selecting my spawner - i then select my pool boss category and click create pool boss item.
When I run it, it spawns fine and pool boss works but my dotween animation component that is attached to my prefab isn't doing anything.
Strange? What could be happening?
I am thinking that this has something to do with instantiation with allowing dotween to run the first time because the prefabs are being auto-added.
edit------------
Figured it out. For anyone else having a similar issue, it wasn't immediately obvious that I had to use OnSpawned (which gets called once everytime a prefab is spawned by pool boss) in a script attached to my prefab which then calls my dotween.
|
|
|
Post by DarkTonic Dev on Sept 21, 2017 5:58:22 GMT
Does it fail even the first time the item is spawned? What event is your code that starts the tween in? OnSpawned? Start? Awake? It should be on OnSpawned. If it's something that comes with a tween product, it's probably not going to be using pooling events like OnSpawned. You may need to modify it. You may need to contact the Dotween author if you can't figure out what event it is using. Maybe ask him if there's a way he's made it work with pooling plugins before...
Auto-add really shouldn't be used except when testing stuff. Instantiation is bad.
|
|
|
Post by starfoxy on Sept 21, 2017 6:31:03 GMT
Hey ya, thanks. I must have cross posted just as you answered. You were right. I wasn't using OnSpawned/Awake. It works great now. Thanks again for all of your help.
|
|
|
Post by DarkTonic Dev on Sept 21, 2017 6:33:00 GMT
Awesome, glad it's sorted!
|
|
|
Post by starfoxy on Sept 21, 2017 6:48:03 GMT
That being said, where should I be using OnDespawned? Can I just put it into the same script on my prefab where I am calling OnSpawned?
For other users of dotween, I came across some other important info for use with Core GameKit.
From the web:
... "I am using dotween with CoreGameKit to spawn game objects that have an animation. In case it helps anyone, I found that when I set a looped tween going in OnSpawned() it would interfere with subsequent wave generation unless I put a transform.DOKill(); into the OnDespawned() method."
... "You definitely should call a tween Kill when despawning your object, since auto-kill is activated only when an object is destroyed, not just deactivated (and thus will otherwise continue playing within the spawning/despawning cycles of a pool system)."
|
|
|
Post by DarkTonic Dev on Sept 21, 2017 16:28:26 GMT
You can put it in any script on the same Game Object (not sub-game objects) that is being spawned. If you have it multiple scripts, that is fine, they will all be called.
Pretty sure I've done the tween kill before.
|
|