Cross Scene Reference

Overview

The Cross-Scene Reference Package provides a convenient way to reference Unity objects across multiple scenes. By using a generic component-based system, it allows developers to create cross-scene references for any Component, such as Transform, Rigidbody, or Collider.

Features

  • Seamless Cross-Scene Object References: Reference objects between scenes directly.
  • Persistent Data Management: Handles references between loaded scenes without issues.
  • Simple API: Easy-to-use methods to get/set references.
  • Generic Cross-Scene Object References: Use a generic approach to reference any Component type across scenes (e.g., Transform, Rigidbody).
  • Serialization Support: Automatically handles the serialization of references across scenes.
  • Type Safety: Ensures references are strongly typed at compile time.

Key Components

  • CrossSceneReference<T>: A generic class used to reference components of type T (e.g., Transform, Rigidbody) across scenes.
  • CrossSceneReferenceId: A monobehaviour script that uses a global unique guid to identify the object which is a combination of m_LocalIdentfierInFile and the scene path.

Best Practices

  • Use Type Safety: Always specify the correct component type when using CrossSceneReference<T> to avoid runtime errors.
  • Avoid Circular Dependencies: Ensure that objects referencing each other are not in a loop.
  • Scene Loading Order: Manage scene loading carefully to ensure references are available when needed.

FAQ

  • Q: Can I reference non-Component types?
    A: No, CrossSceneReference<T> is constrained to Component types only.
  • Q: What happens if the referenced object isn't loaded?
    A: The system will return null. Handle this scenario to avoid null reference exceptions.
  • Q: Can I reference objects from unloaded scenes?
    A: No, only active and loaded scenes can be referenced.

Support

For additional support, visit our support page or contact us via email. contact@kabreetgames.com

License

The Flow Map Painting Tool is licensed under the Unity Asset Store End User License Agreement.