Ontriggerenter/exit issues

Hello all
So I am dropping my player well inside the trigger area but the Ontrigger exit method fires right off the bat and the ontriggerenter method load twice.I put in the bool to try keep it to just one load but it keeps loading 2 instances of world.Is it the my code or is Unity just finicky.Using unity 19Lts.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class loadareas : MonoBehaviour {

    GameObject gras;
        Vector3 off;

private bool on;

void Start () {
       
             on=true;
    }
   
     private void OnTriggerEnter(Collider other) {
   
    if (other.tag =="Player") {
           if (on==true)
    
{ on=false;
        StartCoroutine (load ());
        }
        }
    IEnumerator load()
    {
        ResourceRequest loadtemp = Resources.LoadAsync("world", typeof(GameObject));
        while (!loadtemp.isDone)
        {
            yield return null;
        }
        gras = loadtemp.asset as GameObject;
        Instantiate(gras, transform.position+off,transform.rotation,this.gameObject.transform);
        gras = null;
   
    }
    }
private void OnTriggerExit(Collider other) {
    Debug.Log(on);

if (other.tag =="Player"){
    if (on==false){
   
    StartCoroutine (wipe ());}
      }
IEnumerator  wipe ()
{   
    for ( int i=transform.childCount-1; i>=0; --i )
    {
        var child = transform.GetChild(i).gameObject;
       
        yield return null;
        Destroy (child);

        }
   
        Resources.UnloadUnusedAssets (); 
    on=true;
   
    }
     }
   
}

Was all this already in scene? Is it colliding with something it’s already inside of like at location (0,0,0)?

I had an issue where sometimes the trigger calls would happen before the “move me to my startpoint” code executed, totally random and dependent on frame timing, so sometimes I would just explode spontaneously, but most of the time it worked. Really bizarre. I solved it by printing out the name of the collider I had hit. AHA!

Well figured it out wasn’t a problem with the above script.I have the floating origin script from the wiki on my player and it was moving the world. facepalm moment.I do know though that the ontriggerenter and exit calls have always triggered twice don’t know what the possible reason for that is its just freaking annoying? .Thx Kurt
This origin shift is going to be a headache you can exit a trigger and move a couple meters and reenter the trigger zone if the world shifts.Whats the maximum recommended distance from the origin to avoid any glitching issues?

Hm, they really shouldn’t in the simplest case… I suppose they would if you have multiple colliders on yourself, or if you are talking about multiple colliders.

One approach is to use the GetInstanceID() of what you hit, and then items (like your player) would keep track of the last collider they triggered INTO by writing this ID down, and if they hit it a second time, disregard that second time.

I would say move it at least a few hundred units before snapping it, just for debugging sanity when you’re looking in the scene.

I would say move it at least a few hundred units before snapping it, just for debugging sanity when you're looking in the scene.

I had it at 100 so increased it to 999 doesn’t floating point precision only change per zeros added or is that not correct?so 999 should give the same as 100?

Internally floating point knows nothing about decimal zeroes. It only cares about binary zeroes.

This means every time you double the value, you lose one bit of precision you used to have down low.

From this:

https://en.wikipedia.org/wiki/Single-precision_floating-point_format