I have a HUD Navigation bar set with navigation points for interaction machines used for quest givers.

https://imgur.com/a/B72Pza9

My Navigation Point Prefab is unchanged from the prebuilt one Nav Point (for prefabs).

My quest givers show a UI HUD over their heads depending on the state of the quest. Is there a way to access the combatant the navigation point is attached to? And then assign a sprite to the navigation point via code?
  • The point prefab's HUD components have the content they display available as user/content.
    I.e. you can use a HUD Condition component to do checks on it, e.g. enabling/disabling child objects with different sprites based on variable conditions or status conditions of the combatant they display (if the interaction's game object is also a combatant, otherwise just variable conditions, e.g. via object variable components).
    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!
  • Finally getting around to playing with this again. If you leave the sprite empty in the Navigation HUD navigation point will it should show the sprite from the point prefab or do I need to create separate navigation points for each different variable I am checking in the HUD Condition components?

    For checking the variables themselves, I should use Game Object of user in the HUD Condition components?

    Finally, if I can show the underlining point prefab sprites, will I need to add separate UI Content components to the root of the point prefab to show the image child objects for each state? Or is there a way to get the sprite of the UI Content to select whichever is enabled?

    https://imgur.com/a/9rGcYbz
  • If the point has no sprite content, the sprite would be set to that (so no sprite displayed). If you don't want to use a sprite icon and instead add id directly on the point prefab, you can do that. Just don't set up the sprite (Image component) as part of the UI Content component of the prefab, i.e. it'll not be used to set content.
    shortyyard said: For checking the variables themselves, I should use Game Object of user in the HUD Condition components?
    Yes, User would be the content that's forwarded to the point prefab.
    shortyyard said: will I need to add separate UI Content components to the root of the point prefab to show the image child objects for each state? Or is there a way to get the sprite of the UI Content to select whichever is enabled?
    Neither.
    You simply define the different sprites as regular Image components. I.e. each sprite is it's own child object of the prefab. You can use the HUD Condition (or e.g. a Game Object Manager component to enable/disable the sprites as needed.

    The UI Content setup is used for displaying content that's coming from the HUD's content/user. For your needs to show sprites based on some condition, you simply need to use regular sprites that you set up in the prefab.
    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 August 2023
    Thanks for answering all my questions. I am having issues getting the conditions to check the object variables attached to the user. Playing around with it and looking at source code, does HUD Condition only check the condition on start? Game Object Manager has an update method so I am also trying to use that but it is not finding the user's object variables as far as I can tell. I tested with a GameObjectManager condition set to the initial value of the object variable and it still isn't activating the child object. However, the sprites show if I remove the conditions all together so that part is set up correctly. I also tested searching by ObjectID and then the condition checks work. Is it an issue with using a local object variable instead of with an object ID?

    https://imgur.com/a/aDjEFYs
    In those screen shots I show the Game Object Manager component's check and the second screenshot is the "user" with the child object containing the Object Variables component.

    I am attempting to write a script to test but I am unsure how to convert the object user to a GameObject or Combatant so I can use GetComponent.
    Post edited by shortyyard on
  • Ah, sorry - checked the code, the Interaction nav points only use the content defined in the HUD for the HUD user/content, unless some kind of content is attached to it's game object (e.g. via a Scene Object component or coming from a combatant). But I doubt it has access to the game object in any case.

    I'll look into it.
    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!
  • Alright, next udpate will have some changes and HUD conditions/etc. can work on object variables on the user - for Interaction nav points using the interaction's game object and for Marker nav points the found game object in the scene (if game objects are used for this).
    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!
  • great thank you!
Sign In or Register to comment.