hey at all,
i’m experimenting with waitforseconds in update(). In the manual is explained that this would greatly reduce the number of checks carried out.
So i changed my Script from :
void Update ()
{
thisMiss1conf = Miss1confirmedScr.Miss1confirm;
if(thisMiss1conf)
{
Einl_Sound_2.SetActive(true);
thisRatPack.SetActive(true);
Miss1Canvas.SetActive(false);
BeendenButt.SetActive(false);
}
if(!jalthiPack1[0].activeSelf && !jalthiPack1[1].activeSelf && !jalthiPack1[2].activeSelf && !jalthiPack1[3].activeSelf &&
!jalthiPack1[4].activeSelf &&thisMiss1conf && thisRatPack.activeSelf)
{
Miss1done = true;
thisMissaccImg.SetActive(true);
}
}
to :
void Start ()
{
Miss1confirmedScr = Einl1Obj.GetComponent<Einleitung_1>();
thisRatPack.SetActive(false);
Einl_Sound_1.SetActive(true);
Einl_Sound_2.SetActive(false);
StartCoroutine(xxx());
}
void Update ()
{
thisMiss1conf = Miss1confirmedScr.Miss1confirm;
StartCoroutine("xxx");
if(thisMiss1conf)
{
Einl_Sound_2.SetActive(true);
thisRatPack.SetActive(true);
Miss1Canvas.SetActive(false);
BeendenButt.SetActive(false);
StartCoroutine("xxx");
}
if(!jalthiPack1[0].activeSelf && !jalthiPack1[1].activeSelf && !jalthiPack1[2].activeSelf && !jalthiPack1[3].activeSelf &&
!jalthiPack1[4].activeSelf &&thisMiss1conf && thisRatPack.activeSelf)
{
Miss1done = true;
thisMissaccImg.SetActive(true);
StartCoroutine("xxx");
}
StartCoroutine("xxx");
}
IEnumerator xxx()
{
yield return new WaitForSeconds(0.1f);
}
well, it works and i dont get any errors. What i would like to know if its really correct or nonsens. And if its really a benefit for perfomance although i cant “see” a big difference in fps.
But i think “if so” i have several more scripts in which the functions in Update() hasn’t to be calculated absolutely precise in every frame and could be also changed in this way.
And in summary it would make a difference for perfomance, wouldn’t it?
I’m very nosily about your opinion or tips and tricks
yours