edited September 11 in ORK Scripting
When my characters get instantiated, they got their default equipment on their equipmentParts. Then a frame or two later, some equipment get replaced with the equipment setup in the conditional prefab.

Is there any flag I can wait to make sure the character is totally instantiated with all his equipment's conditional prefab ? I have other script that rely on the equipment spawned on my character and I can't manage to have the script be notified when a conditional prefab get spawned/despawned.

Thank you
Post edited by frednorm2000 on
  • Is this only happening when you start a new game (i.e. when you add players and spawn them) or also during regular scene changes?

    Generally, when spawning (and spawning equipment) it should use the currently valid prefab, i.e. also taking conditional prefabs into account.
    If this is happening when starting a new game only, I'd suggest adding a Wait node before spawning the player (e.g. even 0 second wait to continue in the next frame).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited September 12
    Our Combatants spawn via C# command Combatant.Object.Spawn(). It can spawn during loading of the scene or any time during gameplay.

    It seems to happens every time a Combatant spawn. As you mention, leaving a frame between the instruction Object.Spawn() and the instruction of my script relying on the equipment, seems to work most of the time, but not quite 100% of the time. Not sure if it's related to machine performance/speed

    Adding a Wait node is not an options since spawning is done via C# script, not visual scripting

    P.S. Using ORK2
    Post edited by frednorm2000 on
  • Ok, since you're using custom scripting here - is the equipment spawned via Equipment Viewer components or also via custom scripts?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Equipment Viewer
  • Should still work correctly in that case. What are the conditions of your equipment's conditional prefabs?

    Generally, as long as the combatant (independent of the game object) is already fully initialized, spawning it should automatically use the correct equipment prefabs via the viewers.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I ended up waiting two frames after setting the variable condition in the Equipment's ConditionalPrefab setting. Works as required. Thank you
Sign In or Register to comment.