Post by Super Admin on Feb 7, 2014 17:10:45 GMT 1
Here are some warnings for all Playmaker users and some tips that can help you to use Playmaker easier:
1. Backup your project ALWAYS when you working with Unity and especially Playmaker. I had some issues when working with global variables and for no reason some of them are switched with each other, this is probably done because you create similar global variable names and system can't properly recognize your variables. If this happens it's not that big problem if you know what are you doing and small number of FSMs use those global variables, however if you global variable and multiple prefabs you will encounter problems. You will notice then some global variables that use same name (which is not possible for globals, only for local variables). If you try to delete that variable all of your prefabs will loos that variable and you will have to set them again, then you delete both of them and create them again. Fastest way is to shutdown Unity, delete project, restore project from backup folder and start unity again. Luckily I didn't have this problem for a while but beware of that and always backup your project.
2. When you get some warning about null reference exception using Playmaker just press pause button in Runtime twice and it will somehow refresh Playmaker action. This problem can happen when you drag your actions manually above or beneath other actions (will not happen when you use right click and then Move Action to Bottom / Top), also it can happen when you click on build string action and overall using string actions or actions where you have options to set how many variables you want, for example you use build string action, default is 3 parts and you want only 2 strings, when click on that you can get this error but no worries, just click on that action in any field and it will be fine.
3. You can't change name of global variables or global states, you can only delete them and create them again. Earlier you could change names of globals then you get warning that will be changed globally, after that in most cases action cause some problems and errors, that's why they removed this function, probably they will add it again when solve those problems but until then you just have to be careful when adding names to globals cause they can't be changed.
4. Instead of using global variables (they are easier to access ofc) you can use local variables and use actions like Set or GetFSMInt or game object or any other variable, it can work this way but requires additional work effort. My inventory could be build this way and in future I will maybe change it to completely work using local variables and those actions Get or SetFSM... For example if I want to send event to inventory manager to open Inventory which is child of InventorySystem, i will store my inventory to be Inventory (only global variable here) and all children I can store in local variables so when I want to access certain child I just use action FindChild called InventoryManager under Inventory, store in local game object variable and send event to that game object to open inventory ( same result would be if I used send event to inventory manager that is already stored in global variable InventoryManager). You don't have to store that InventorySystem in global at all, you can just use action FindGameObject called InventorySystem, store in local variable and then use same method find child, send event... but this method can be heavy for system if you have many items in your scene.
5. When using events instead of nesting your transitions under same state you can use global transition (right click on state and choose global transition) with local events, this is useful if you want to access certain states from any state and any FSM (no need to use global events) on same game object, even for children and parents, not possible to use on different game objects. For example you have game object A, and children under A1, A2, A3 and you want to send event from A3 to A2, you can just use action SendFSMEvent and choose A2 game object, choose FSM name and choose event that is Global Transition. Same goes for A1 and event parent A and vice versa to send events to children from parents no need to use global events for this. This is helpful also for visual things, no need to have hundreds transition that can look pretty bad and not organized.
6. If you have errors saying that some actions are obsolete you can just turn off that errors checking in Playmaker preferences and error will not be shown anymore. Those actions such as SendEventToFSM is legit to use but marked as obsolete because action SendEvent can do same job.
Hope this tips and warning help you guys
Cheers!!!
1. Backup your project ALWAYS when you working with Unity and especially Playmaker. I had some issues when working with global variables and for no reason some of them are switched with each other, this is probably done because you create similar global variable names and system can't properly recognize your variables. If this happens it's not that big problem if you know what are you doing and small number of FSMs use those global variables, however if you global variable and multiple prefabs you will encounter problems. You will notice then some global variables that use same name (which is not possible for globals, only for local variables). If you try to delete that variable all of your prefabs will loos that variable and you will have to set them again, then you delete both of them and create them again. Fastest way is to shutdown Unity, delete project, restore project from backup folder and start unity again. Luckily I didn't have this problem for a while but beware of that and always backup your project.
2. When you get some warning about null reference exception using Playmaker just press pause button in Runtime twice and it will somehow refresh Playmaker action. This problem can happen when you drag your actions manually above or beneath other actions (will not happen when you use right click and then Move Action to Bottom / Top), also it can happen when you click on build string action and overall using string actions or actions where you have options to set how many variables you want, for example you use build string action, default is 3 parts and you want only 2 strings, when click on that you can get this error but no worries, just click on that action in any field and it will be fine.
3. You can't change name of global variables or global states, you can only delete them and create them again. Earlier you could change names of globals then you get warning that will be changed globally, after that in most cases action cause some problems and errors, that's why they removed this function, probably they will add it again when solve those problems but until then you just have to be careful when adding names to globals cause they can't be changed.
4. Instead of using global variables (they are easier to access ofc) you can use local variables and use actions like Set or GetFSMInt or game object or any other variable, it can work this way but requires additional work effort. My inventory could be build this way and in future I will maybe change it to completely work using local variables and those actions Get or SetFSM... For example if I want to send event to inventory manager to open Inventory which is child of InventorySystem, i will store my inventory to be Inventory (only global variable here) and all children I can store in local variables so when I want to access certain child I just use action FindChild called InventoryManager under Inventory, store in local game object variable and send event to that game object to open inventory ( same result would be if I used send event to inventory manager that is already stored in global variable InventoryManager). You don't have to store that InventorySystem in global at all, you can just use action FindGameObject called InventorySystem, store in local variable and then use same method find child, send event... but this method can be heavy for system if you have many items in your scene.
5. When using events instead of nesting your transitions under same state you can use global transition (right click on state and choose global transition) with local events, this is useful if you want to access certain states from any state and any FSM (no need to use global events) on same game object, even for children and parents, not possible to use on different game objects. For example you have game object A, and children under A1, A2, A3 and you want to send event from A3 to A2, you can just use action SendFSMEvent and choose A2 game object, choose FSM name and choose event that is Global Transition. Same goes for A1 and event parent A and vice versa to send events to children from parents no need to use global events for this. This is helpful also for visual things, no need to have hundreds transition that can look pretty bad and not organized.
6. If you have errors saying that some actions are obsolete you can just turn off that errors checking in Playmaker preferences and error will not be shown anymore. Those actions such as SendEventToFSM is legit to use but marked as obsolete because action SendEvent can do same job.
Hope this tips and warning help you guys
Cheers!!!