Results 1 to 6 of 6

Thread: Global UI and visibility issues

  1. #1

    Global UI and visibility issues

    I think I'm seeing a bug with Global UI but I'm a bit surprised by it, so I figured I'd post here and see what folks think. I'm trying to a custom global UI panel for players in my game and I can get everything working the way I'd like except for one issue: the UI is only visible to the players that were connected to the server when the game was loaded. I've stripped everything down to a simple table with nothing else in play. My UI XML is:
    Code:
    <Panel id="UIPanel"
    	padding="5 5 5 5"
    	height="50"
    	width="70"
    	rectAlignment="UpperRight"
    	offsetXY="0 -200"
    	color="rgba(0,0,0,0.5)"
    	allowDragging="true"
    	returnToOriginalPositionWhenReleased="false">
    	<VerticalLayout rectAlignment="UpperRight">
    		<Button onClick="doClick">Click</Button>
    	</VerticalLayout>
    </Panel>
    and the global LUA script is just a stub function for doClick.

    When I load the game, I can see the UI, anyone on the server at that point can see it, but if someone joins later, they don't. Until I reload the game.

    I'm on v12.4.2.

    Is this a bug or am I doing something wrong?

    Thanks!

  2. #2
    Join Date
    May 2020
    Location
    on the earth
    Posts
    99
    my guess, there is an event to trigger the UI. after your description it seems like onLoad(), which isnt triggered afterwards, if im not wrong. maybe you have to call the ui, if a player connects within the function onPlayerConnect( person)

  3. #3
    Join Date
    Sep 2017
    Posts
    338
    It's a bug. The UI is initialized on the host before any onLoad() happens and should be initialized on each client at join time. However AufderWelt is correct that you can work around the problem by forcing a UI update when a player connects.
    Code:
    function onPlayerConnect()
        UI.setXml(UI.getXml())
    end
    should do the trick

  4. #4
    Thanks, AufderWelt and cche - I'll give that a try tonight!

  5. #5
    Well, that didn't work. They still don't see the UI.

    One interesting fact, though: the UI is loaded - at least to the point where a script can call UI.getAttribute on the panel and get back results. But nothing is rendering...

  6. #6
    Ok - after a bunch more testing, I've got this narrowed down. First off, a lesson learned (again, since I have learned this one repeatedly): always actual do the repro that you claim to do. I finally did what I said above from scratch and... it worked fine. Which was actually really good since it let me narrow down the problem.

    Turns out the actual bug is to have Custom Assets and have two of them with different names but referencing the same URL. If that happens, the result is apparently two things happen:
    1) The first time I load the game, I don't see the Global UI. If I load it again immediately, everything shows. (Note: the UI is there via UI.getAttribute calls.)
    2) Any player who joins the server after the load won't see the UI unless the game is reloaded. (Again, UI is apparently there for script interactions.)

    So, a much less severe bug but still something that TTS should either handle or provide an error message about. And it is easily fixed in my game so that I shouldn't run into it (it wasn't intentional to have the same image URL referenced twice).

Similar Threads

  1. XML UI visibility has incorrect behaviour
    By Ironcinder in forum Bug Reports
    Replies: 2
    Last Post: 01-23-2020, 04:13 PM
  2. [SOLVED] Improved FoW & Storing Visibility
    By LordAshes in forum Scripting
    Replies: 0
    Last Post: 08-25-2019, 08:58 PM
  3. Visibility By Player
    By LordAshes in forum Scripting
    Replies: 2
    Last Post: 07-08-2019, 03:41 PM
  4. Per-object player visibility
    By Unreal_Ed in forum Suggestions
    Replies: 2
    Last Post: 05-05-2018, 07:15 PM
  5. Object visibility toggle option
    By Cerne13 in forum Suggestions
    Replies: 0
    Last Post: 11-29-2017, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •