Hi. I hope everyone is having a great weekend. I have a question regarding menus and show/hide elements.
Firstly, how can I hide the previously selected menu elements when I reopen the tab? The information seems to remain there.
Example: I open a menu, select an objective or document (information like status, description, texture populates the fields). I switch to a different menu that shares many of the same fields, and that information is still there (from the previous item) until I select another document/objective. Here's a video showing this issue occurring.
https://drive.google.com/file/d/1islTKeNexTWOhOJXsYOVCr2QhBDLlyIe/view?usp=sharing
I'm sure it's something stupid and obvious that I'm missing, as usual. I've tried hiding the elements individually when the menu is off, when the menu is closed, but when I open the menu back up, it's back.
Secondly, I've been trying to get the cursor and all of the icons (when selected) to be affected by the post-processing filter I added, but I can't seem to do that. Currently, I have a CursorUI Prefab with "Screen Space - Camera" set, the render camera is set, and the plane/layer are set. That prefab is linked to "Unity UI Cursor Prefab," and cursor rendering is set to "Unity UI."
Have I missed something? All the cursor elements still don't appear to be affected by the post-processing filter.
Thank you!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
In the case of Objectives and Documents: AC records the "active" ones independently of when/how they might be displayed. To remove their display, you'll need to manually de-select them via the DeselectObjective and CloseDocument functions respectively.
Here's a function you can copy into a C# script to handle this:
To run this, attach to a prefab and then reference that prefab with the Object: Call event Action (see this tutorial for an example).
AC won't be directly involved here, beyond the necessary use of the UI-based cursor. Screen Space Camera is the way to go - is it on a layer affected by the post-processing?
Yes, The Prefab is on the Screen Space Camera layer, which should be affected by the post processing. I use the same technique for the menu. Here's an image
https://drive.google.com/file/d/1HLi_MOiUbhgehax0DaqOaH4ErFw3rATW/view?usp=sharing <- I added a screenshot of two separate prefabs with the same settings. You can see the Cursor Selection in the Character Menu - unaffected by the post-processing.
Also, thank you for the script.
It's a case of no "Render Camera" assigned in the component, which isn't possible in the prefab as the MainCamera is part of the scene.
You just need a script that assigns this at runtime:
Thank you again. I'll look into that in a little bit. Sorry to pile more on top, but I've noticed that Objective States Descriptions don't update in the Description field when the State is changed. I added custom descriptions for each State of an Objective, but it seems to display the main top description instead of all of the Objective States Descriptions. I found this thread with a script from you. Should I just use this to fix this issue or am I doing something wrong/failing to update something properly in ActionList? Thank you https://www.adventurecreator.org/forum/discussion/10089/objectives-label-visible-after-completion
Please try to create separate threads when posting unrelated issues in future - it helps others to find them when they encounter similar questions.
Does the Label element that shows the wrong text have its Objective text property set to Description or State Description? If the latter, does the issue only occur if the state is changed while the Menu is opened (i.e. closing/re-opening the Menu causes it to correct itself)?
It'll be best to see screenshots of your setup.
Please ignore this last one pertaining to State Description and I'll add a new thread once I finish with these.
The script for the Cursor worked - the cursor is now affected by the post processing effect, but there seems to be a new issue that I'm not sure how to fix.
The Cursor graphic appears to move off center from the actual mouse the further you pan left or right, up or down. And it seems to occur whenever I enable the script. Here's a screenshot of what I mean.
https://drive.google.com/file/d/1xB5zT6ZU4Q3-A8px03p8RsT0ROfK34Cl/view?usp=sharing
I'm looking into methods for capturing both cursors in video. For some reason it doesn't want to capture both.
If you're rendering the Canvas in Screen Space, it will have a physical presence in the scene. It could be that the offset is caused by the "Plane Distance" field, but the Unity UI Cursor should account for this, and I can't reproduce such an issue.
Can you share your CursorUI's root Inspector?
https://drive.google.com/file/d/1bsF-_yVdqfhGR8Mezbin30ASl_lK1EgN/view?usp=sharing thank you again for all the help.
What is your Unity version, and what does the Canvas Scaler component look like?
Do either the Plane Distance or Resize Canvas fields have an effect?
Hi. Sorry for the late Reply. My Unity version iss 2022.3.9f1 and here's the cursor set-up https://drive.google.com/file/d/18h04wttDt-H_cRwSf0gxy7r60IY6jD6v/view?usp=sharing. Thank you again.
Is your Game window's aspect ratio fixed at 1.778, and is there any difference in the position issue (ignoring scale changes) by tinkering with either the UI Scale Mode or Screen Match Mode fields?
Hi! Sorry to circle back to an old issue but I'm stuck. I've used the DeselectObjectivesAndDocuments script (from this thread) and I was able to make everything work as intended for the Objectives menu. For Documents I'm unable to desect the object when the menu is closed - everytime I reopen it it shows the last selected document
https://drive.google.com/file/d/1Xp2-mPHTAVhfCyEKYiQZSCgVTu7-jLdO/view?usp=sharing
<- here's a video of the setup. I have set "Show" to the elements when you open the menu and hide elements when you close it + added the deselect script I was talking about.
Also, is there an option or something that I have to toggle to get the "Pressed buttons" to remain "Pressed" when an option is selected? As illustrated in the video, the selection remains selected, but the "Pressed" state seems to reset with the menu closing. Thank you in advance. <- if this separate portion with the "pressed" issue creates confusion I can create a separate thread for it.
Sorry, which thread/script?
You can deselect the active Document with the CloseDocument function, but have you tried hiding the Document label element when the Menu turns on? You can show it again as part of the Document list element's "On Click" ActionList.
I'm not sure which button you're referring to - let's make a separate thread for this.
sorry, this thread is convoluted due to me posting multiple things in it
"public void DeselectObjectivesAndDocuments ()
{
AC.KickStarter.runtimeObjectives.DeselectObjective ();
AC.KickStarter.runtimeDocuments.CloseDocument ();
}" > this script you provided.
The "close.document" is already in the script and added to the ActionList.
https://drive.google.com/file/d/1J6CJMBCIqsoQIbSQnfDGRLfpYkOvp6X6/view?usp=sharing <- here's a screenshot of the setup. The Objectives part works just fine. it deselects everything. The CloseDocument part doesn't seem to want to work. Unless I made some mistake.
So long as the event has the prefab assigned, and not the script file directly, that should be OK - but the two functions aren't equivalent.
Have you tried the hide-when-turn-on method I mentioned above?
That did the trick. thank you! I used that same technique for some stuff on the Objectives, but I was confused about why that script didn't have the same effect on documents. Thank you so much. Have a wonderful weekend.