Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: iEpic on February 05, 2015, 05:08:22 AM

Title: Setting Global GameObjects
Post by: iEpic on February 05, 2015, 05:08:22 AM
I'm having to set a lot of my gameobjects to playmaker global gameobjects, and I was wondering how I could set a global gameobject that is disabled.

For example...
I have a game object I want to start deactivated, but need the get owner to save it as a global gameobject. It won't save it if it starts off deactivated.
Title: Re: Setting Global GameObjects
Post by: blackant on February 05, 2015, 07:18:30 AM
you may use find gameObject by name for exemple at the begginning of the scene
Title: Re: Setting Global GameObjects
Post by: iEpic on February 05, 2015, 07:19:40 AM
I thought it was bad to use find gameobject??

Remember reading that somewhere a long time ago thats why I never used it.
Title: Re: Setting Global GameObjects
Post by: Lane on February 05, 2015, 07:26:02 AM
Its not a forbidden action or something, its just cautiously used because if used too much in a mid - large scene it can cause performance issues. For instance in the middle of a game you're still using Find GameObject on every new creature that spawns to find some database or whatever, that will likely affect performance adversely.

You can definitely use a proxy of some sort to host your variables, but this is something you want to think about and find a good way that will work for your game when it comes to intercommunication between entities, managing persistent data, database retrieval, etc...
Title: Re: Setting Global GameObjects
Post by: iEpic on February 05, 2015, 07:28:52 AM
So doing find gameobject when the scene loads will be fine as long as it's not used a bunch of times.
How many times are we talking about?
Can I use it on 50 game objects and it will be fine, as long as it's at the beginning??
Thanks for your help BTW I really do appreciate it
Title: Re: Setting Global GameObjects
Post by: Lane on February 05, 2015, 07:34:02 AM
Yeah typically you want to put heavy stuff like that at the start of the scene so you can hide the process behind a Loading Bar or something and the user won't see the performance hit during the middle of the game.

It's all about experimentation and depends on how slow it really is in your game for you to decide what to do.
Title: Re: Setting Global GameObjects
Post by: iEpic on February 05, 2015, 07:35:02 AM
Awesome!!

Thanks so much for your help!