well I have done more research on the matter and attempted to get an action set up for it.
so after looking at other actions and taking a base from them, along with this thread I found
http://answers.unity3d.com/questions/65030/static-batching-on-dynamically-instantiated-conten.html I think that I am almost there, my problem following that script example is that I dont know/cant find the default staticbatchroot that unity creates at build time.
for now I tried to assign a gameobject as the root (for my purposes, as there are no batched items at the begining of the game the default is not an issue)
so I tried this
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.UnityObject)]
[Tooltip("Removes all keys and values from the preferences. Use with caution.")]
public class staticCombine : FsmStateAction
{
[RequiredField]
[Tooltip("RootGameObject")]
public FsmGameObject gameObject;
public override void Reset()
{
gameObject = null;
}
public override void OnEnter()
{
GameObject go = gameObject.Value;
StaticBatchingUtility.Combine(go);
}
}
}
this built ok with no errors however when trying it in the preview window it did not batch, so instead I tried implementing more of the suggested code from sample above to
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.UnityObject)]
[Tooltip("Removes all keys and values from the preferences. Use with caution.")]
public class staticCombine : FsmStateAction
{
[RequiredField]
[Tooltip("object to add to static batch")]
public FsmGameObject gameObject;
[RequiredField]
[Tooltip("RootGameObject")]
public FsmGameObject gameObject1;
public override void Reset()
{
gameObject = null;
gameObject1 = null;
}
public override void OnEnter()
{
GameObject[] go = gameObject.Value;
GameObject root = gameObject1.Value;
StaticBatchingUtility.Combine(go, root);
}
}
}
this gave me an error saying it can not convert from type gameobject to gameobject[] so this has came to the end of my knowledge currently, from searches this is because the [] is an array? would make sense that the [] would hold the list of other game objects within it?
so now I am lost, I find this fun and interesting but I think I have reached my current skill level.
Edit*
I just tried making an array with the code provided, built correctly but didnt work
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.UnityObject)]
[Tooltip("Removes all keys and values from the preferences. Use with caution.")]
public class staticCombine : FsmStateAction
{
[RequiredField]
[Tooltip("static batch root")]
public FsmGameObject gameObject;
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("object to add to static batch")]
public FsmGameObject gameObject1;
public override void Reset()
{
gameObject = null;
gameObject1 = null;
}
public override void OnEnter()
{
GameObject go = gameObject.Value;
GameObject[] gos = new GameObject[10];
for (int i = 0; i < 10; i++) gos[i] = gameObject1.Value;
StaticBatchingUtility.Combine(gos,go);
}
}
}