Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Help with RememberTag script.



Just having some novice problems making a custom remember script, based on RememberName script. 
The script compiles just fine, but it doesn't seem to save the tags (In this game in particular, is only a scene with lots of varible work and changing gameobjects propierties so I have a lot of remember scripts to do....

So I don't know if I just messed up with Unity's code or AC.


Here it is:

https://pastebin.com/A8H8prgc

Comments

  • edited June 2018
    Works OK for me.  What are you attaching it to?
  • edited June 2018
    It's a button script inside a AC "controlled" Cavas (UI unity on Scene), but the element itslef is not handled by AC. The gameobject itself, main script button, is untagged on default, with a fsm that changes tag if clicked, and the remember tag script.

    Note: By Controlled I mean AC barely handles open close of the menu, nearly any element inside.

    Without openning Unity, I have some considerations about the problem:

    The Load system gave me problems (the Unity UI in scene loses linked status on load; So i checked the "Reload whole scene on load" on Settings Manager (as I said is a singlescene game), and the the canvas were linked ok, so that problem fixed.

    So when I save, the button is well tagged, on load is default again, so it restore the whole scene, but while Load effectivly restores all other things need to be restored, doens't change the tag data on the button, I don't know if is AC-UI management related. 

    Or if the script for a gameobject in a Canvas should be different, but well, it's just a gameobject with a button script and don't know if it 

    I'm gonna check...

    Yes, the script works on a hotspot. Remember the tag. But don't in the UI menu on scene. 

    In this game, I'm using 1.62.5 AC version, Unity 3.1f1
  • Ok, can be because the gameobject is deactivated on Load, and the element is not handled by AC, so then can't find it?

    Seeing lots of related isues about deactivated gameobjects causing issues when AC is not directly handlen them...
  • edited June 2018
    Only with respect to AC-controlled canvases.  Indeed, the save system requires an object to be enabled in order to be detected - but an issue with Unity UI unfortunately requires that UI canvases are disabled when turned off.

    What you could do is instead move the RememberTag component to a new GameObject in your scene, and set the "GameObject with tag" as an exposed field.  You'd need to create a custom Inspector for it (since the ConstantID it derives from has one), but it's simple enough:


    Since the Remember script is always active, it'll always be found.  And since the exposed field is explicitly assigned, it should always be able to find the object even when de-activated.

    Be sure to place the RememberTagEditor script in a subfolder named Editor.
  • Lots of thanks, This is a perfect solution for lots of things related with UI not enterly handleds by AC.

    Anyway in this project I think I finally only do autosaves, every day loop has a very heavy scripted workout to achive a correct load in the middle of the day loop, and perfectly saving the complete day loop is going to be carefull to program even if the player cannot save on them middle of the day. Anyway, a way to make sure remembers works on UI is going to be critical so it's a life saver. 

    I have to study Save/Load sytem in depth to make a multiple Autosave system with custom info autolabeled as names.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!