playMaker

Author Topic: Total number of scripts in scene and performance  (Read 793 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 352
    • View Profile
Total number of scripts in scene and performance
« on: February 01, 2017, 01:41:36 AM »
Hi

I just wanted to ask, i have over 1300 scripts in my scene and i am optimising my scene for mobile, the fps is a little low but i was wondering is it a good idea to disable loading of FSM's until the player is close to the object. Kind of like LOD works.

Or is there another way?

Nick

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Total number of scripts in scene and performance
« Reply #1 on: February 01, 2017, 02:45:57 AM »
I do similar performance increase "feature" with my tree objects. So If I have a +10,000 trees in my scene and all of them have a class tree attached to them. I enable colliders on them around player's radius. Does your objects have colliders? Try doing the same what I do and see if fps increase.

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 352
    • View Profile
Re: Total number of scripts in scene and performance
« Reply #2 on: February 01, 2017, 03:25:56 AM »
Hi,

Yes i do have colliders on all of them, most of mine are trees too. So how have you setup the player? with a trigger on it and a send event?

also i have child objects with scripts on, do you disable/enable all scripts on child objects or just enable/disable the objects?

Nick
« Last Edit: February 01, 2017, 03:32:20 AM by coxy17 »

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Total number of scripts in scene and performance
« Reply #3 on: February 01, 2017, 03:56:18 AM »
This game I coded in C# and not used playmaker this time... No trigger on this as you are not actually touching the colliders, you just check if there are any nearby trees near you, WHEN the player moves and IF there are then enable colliders on them.

This is helpful: https://docs.unity3d.com/ScriptReference/TerrainData-treeInstances.html
« Last Edit: February 01, 2017, 04:01:04 AM by elusiven »