playMaker

Author Topic: Deactivate a script  (Read 1784 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Deactivate a script
« on: August 18, 2014, 06:06:28 AM »
Hi!

I have a Thruster Script. I use it as a Jetpack in a platformer, but I have a problem. Well, I don't know if it's a problem. Therefore I ask here. :)

This Jetpack has limit with fuel, so when the Jetpack is empty, I disable the Thruster Script. Then I get this error:

"Coroutine couldn't be started because the the game object 'Prefab_Thruster_3' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)"

I know why this happened, but everything is working anyway.
Do you think this will affect the game? Like slow down, lag, etc. The number of errors increases everytime the Thruster Script is disabled, so the number can be very high.

I don't know if there is a way I can svolve this without getting this error.

Thanks! :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Deactivate a script
« Reply #1 on: August 20, 2014, 11:40:19 AM »
When you deactivate a component sometimes other scripts are dependant on it and can't access it so they throw an error. Can't tell if thats whats happening here but if its throwing an error when you turn it off and there are other scripts associated with it then that is likely whats going on.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Deactivate a script
« Reply #2 on: August 21, 2014, 10:42:27 AM »
Hi!

I have only this Thruster Script. But I made the Thruster with Playmaker, so then I don't need to use script. Have more control. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no