playMaker

Author Topic: [SOLVED] PlaymakerTriggerStay .dll Scripts on prefabs ghost lag after deleting.  (Read 2979 times)

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
TL:DR Why are the Ontriggerstay events still being watched and listened for even after changing to Enter/Exit? The profiler still has them there after changing to a different mode.

I stupidly designed a inventory system with on trigger stay and then realised when the game will have hundreds of prefabs spawned in it could get very slow when checking for on triggerstay all the time and the profiler proved that with a 5 ms slow down.

SO I designed it a slightly better way and switched all the FSM trigger actions to on trigger enter/exit just like I read Jean Fabre say in here somewhere. (something like always use trigger Enter/Exit over the trigger Stay for performance). I do not use the SYSTEM events like ONTRIGGERSTAY or any of the Unity system events. I only use the Actions from the action menu.

Well after switching back to Ontrigger Enter/Exit performance didnt get much better at all.... I still saw the lag in the profiler under Playmaker.Update OnTriggerStay and it was the same time about at about 5 ms.

So when I changed the onTriggerStay to onTriggerEnter/Exit in the Action dropdown..... Why does the PlaymakerTriggerStay.cs script still show up on the the action at runtime? is there a reference stored or something? Because after trying each of the trigger modes for one or two tries in the editor (Enter, Exit, and Stay) now all those scripts are stacking up in the component list at playtime.... causing a whole bunch of lag.

I went through my HUGE 40 gig project and made sure there are no OnTriggerStays in the project at all.... I dont get it. They still show up in the profiler and the CPU usage is way way too high now. It says there is over 1100 of them and they are 50% of the load of the entire game?

And then when I click on the script (PlaymakerTriggerStay) that is automatically put on the prefab at runtime even though I am not using it. (im assuming to proxy the events to unity) it just goes to the Playmaker.dll and I cant do anything anyways.

When building the prefabs I just copied the "many times tweaked" FSM with a right click on the component in the inspector and then copy it to the other 30 prefabs in the project folder by highlighting them and them right clicking on the inspector and paste as new. I have 35 prefabs objects that I build at once and each has four FSM's on them. Been doing this for 8 years now and never had a problem.

Should I try rebuilding the FSM from scratch and then hope it doesnt load the On trigger stay .dll scripts on them?

I even tried deleting the PlaymakerTriggerStay scripts from the game objects at runtime but that just make it worse and dropped the framerate even more. So there must be some meta data or reference to them....

Sorry for the long post but I am just frustrated and confused. My Early Access game that I have been working on for four years is doing great and this is killing the forward progress on it during the most important time.

Anybody seen this before? I could really use a little guidance. Im lost.

Thanks very much.

Kevin
« Last Edit: March 05, 2019, 08:56:25 PM by devotid »

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
I just switched to this action and did away with the Trigger Stay checks....
It checks and sends an event if you are inside of a collider. So I dont even need the Ontriggerstay anymore and thats why I noticed it taking HALF of my frame rate today.

https://github.com/PlayMakerEcosystem/PlayMakerCustomActions_U5/blob/master/Assets/PlayMaker%20Custom%20Actions/Physics/InsideColliderInfo.cs

It works perfectly for finding out if you are in a collider at instantiation without having to turn the collider on and of one time.

How do I get these old ghost off my back? I need my frames back! lol

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
Here is the profiler with the game objects in scene showing normal high usage expected in a on triggerstay situation.... The only problem is I dont use ANY ontriggerstay events in my game anywhere. I only tried them once on a few objects and now they are on every game object that uses ANY OntriggerEnter/Exit action.

The second photo is the inspector which shows the auto proxy scripts that must be added by playmaker because of a Tag or something? I dont know.

I must figure out how to reset this info or I have to go back and build 30+ very detailed FSM.


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
What versions of PlayMaker and Unity are you using?

Are the PlayMaker Trigger Stay components on the GameObject at edit time (before you hit play)? They should only get added if the FSM has an action set to check TriggerStay or if it uses the TRIGGER STAY event (check the Events tab).

Also try running PlayMaker > Tools > Preprocess Prefab FSMs.

This resets any event handler flags set in the FSM.

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
Thanks for responding Alex.

Unity 5.6.3
Playmaker 1.8.4 f5

The PlaymakerTriggerStay components were on the Prefabs when not in play mode. I think they just somehow got there from testing the TriggerStay.

So I clicked on the prefabs in the project view and then deleted the PlaymakerTiggerStay components and left the TriggerEnter and TriggerExit components. I had to do this because I changed the actions in the FSM back to TriggerExit/Enter and dont use TriggerStay at all.  No TriggerStay in the Whole project.

I am not using the default EVENTS like TRIGGERSTAY or COLLISIONENTER. I make unique action names and then use the TriggerEvent action as the Unity Events dont seem to work in builds all the time and using a unique names and the TriggerEvent action cured this.

But now I cant get rid of the overhead of the old TriggerStay Components.

I went to Playmaker/Tools and there is no such thing in the drop down.

Just:
- Update all loaded FSMs
- Load all Playmaker Prefabs
- Update all FSMs in build


I also checked the FSM's Event menu and there is nothing but the events that I created. No TRIGGERSTAY or any other default Unity events besides the normal FINISHED event.

Kevin

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
Just looked in the Event Window as well (Never used that before hahaha) and ONTRIGGERSTAY shows 0.

Im using FINISHED 3588 times though. lol Never knew that.

I cannot update Unity as things are going great so far... but Maybe I am not no the newest playmaker?

Kevin

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Delete ON TRIGGER STAY from the Events panel. Right now the Preprocessor just checks the event list (not whether it's used) to add event proxy components. With that event removed, the PlayMakerTriggerStay component should not get added.

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
There is no local actions or events that are remaining that use OnTriggerStay. I was just talking about the Global Events menu. You can not delete the Unity default Actions as they are greyed out. ;) There is nothing that remains of any actions or even trigger checks of any kind. I am using Collider.bounds now as it works better on instantiated objects.

I have deleted any components on the prefabs that are not original and also clicked "Update All FSMs in build" and it seemed to clean out the extra Components on the prefabs in the project view. I will be uploading a build to Steam later today and trying it.

Thanks for your help. Ill report back.

Here is the game I am working on. It was made COMPLETELY with playmaker. My third game on Steam and the first one where I wrote everything with playmaker. (Only other plugins I used were Rewired and Easy Save 2)

https://store.steampowered.com/app/598980/The_Coin_Game/

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
Here is the event list in the FSM

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Ah, I thought you meant the local event list. Even unused events in that list will generate event handler components. But it sounds like you got it sorted out... keep me updated!

Congratulations on The Coin Game - it looks like fun! And nice tidy FSMs :)


devotid

  • Playmaker Newbie
  • *
  • Posts: 45
It ended up being the mouth LCD canvases that I was using to simulate a robots talking mouth. I basically had 15 Sliders that were moving up and down all the time on a 3D world space menu. There was 12 bots in the scene and was adding up to a 6 ms spike to the Canvas renderers. So i ended up replacing their mouths with a animated texture and it doubled the frame rate of the game.

TL:DR Dont use to many dynamic moving world space canvases.

Thanks for your help and advice. It means a lot.

Kevin