Hi all,
Here’s an interesting one. I have a script that in the Start() function, it looks for all objects with a certain script attached, and then does Physics.IgnoreCollision between the CharacterController’s collider, and the objects collider. It works for objects that are spawned by calling InstantiateObject in another script, but not for objects that are put in the world by me in the editor (but still have the needed script attached).
Has anyone seen anything like this, or know some quirky thing about IgnoreCollision that would make this happen?
Thanks,
-T
I didn’t know IgnoreCollision() was supported for CharacterControllers.
The Start() function is called when THAT script is parsed. So there is no way to tell who comes first.
Try Awake() ← this function is called before ALL Start() functions.
Cheers,
The Awake() thing didn’t work…
Is it that the Start() function is called when the script is parsed, as opposed to every time it starts on every object that it is attached to?
And, yes, IgnoreCollision works on CharacterControllers. There is an internal collider object inside the CharacterController. At least, I assume so. Like I said, the script works great for InstantiateObject() objects.
Another possible question, is there a special function that I can write that gets called after ALL scripts are processed for their first time? Like a OnWorldLoaded kind of concept?
-T
It should happen each time the object is created.
Try OnLevelWasLoaded ← important note that this is ONLY call when the level is loaded from another level. What does that mean? Not much - but when testing the level in the editor it’s not called unless another level loaded it.
Cheers,