Search Unity

Is there a way to "refresh" PhysicsEngine in editor mode?

Discussion in 'Scripting' started by Radik-Salakhov, Aug 23, 2015.

  1. Radik-Salakhov

    Radik-Salakhov

    Joined:
    Nov 16, 2014
    Posts:
    16
    Hello,

    For my game I am implementing a designer which works in unity "editor" mode.
    In "editor" mode designer creates new instances of game object with colliders.

    The problem is that these colliders somehow are not always used by PhysicsEngine. I test it using raycast and in most cases ray doesn't hit newly created collider (but sometimes does).

    This problem is solved automatically by switching Unity in "playing" mode and switching it back to "editor" mode. After this newly created collider is always used by PhysicsEngine (ray always hits the collider)
    It looks like that when Unity starts playing it initializes/refreshes PhysicsEngine.

    Is there a way to refresh/initialize PhysicsEngine in "editor" mode?

    best regards,
    Radik