An attempt to understand storage in Spawned Objects

  • Please do not try to find other ways to achieve the goals of the example.

    Please focus on what's going on with these "internal" storage of these instances. Because I cannot, for the life of me, figure out what is going on inside spawned objects with regards their own Box Containers and Value Behaviours.

    I spawn 10 objects.

    Each has a unique rotation.

    Each uses that rotation to calculate (internally) the directions of force (x and y) required for it to apply force in the direction it is facing.

    Each stores those calculations in a pair of Value Behaviours and Box Containers (x and y) for itself, inside itself.

    When later, these objects spawn objects upon themselves, they should apply force in the direction they are facing, to those objects.

    Yet every single one of the instances/spawns, when accessing the Value Behaviours or Box Containers, returns the exact same values, regardless of the direction they're facing.

    THIS IS AN EXAMPLE, in an attempt to understand local storage inside spawned objects/instances. It is not an objective in its own right. It is for the benefit of explaining local storage and how to understand what it does and how it works in hyperPad.

  • Admin

    Spawn will spawn an object based on it's original state when the scene starts.
    So my guess, based on what I'm reading here. Is that your box container/value behaviours are being updated as the scene runs, and you're expecting the spawn to spawn a version based at that moment in time.
    Since at the beginning of the scene the box container is 0 (or some other manually entered value) it will spawn each new version with that.

    I think a solution on our part would be to have a toggle on spawn to spawn the object based on it's state when the spawn is called.
    @Hamed is this doable?

  • @Murtaza please do this. It’s crazy something like this hasn’t already been made, as I have to go to some uncomfortable extend to dynamically create spawned objects with different IDs.

    A “copy from original state” and “copy from current state” would be much better. E.g., if I’m spawning a list I can just do:

    Set “label1” text to “Test”
    Spawn Object “label1” with current state

    Instead of doing my current method which is creating a unique Broadcast ID for objects using their location to provide the information I could overwise just apply using “with current state”

Log in to reply