Forum rules - please read before posting.

changing the Hotspot detection method

In my scenes I have rooms with 1 or 2 Hotspots away from each other and I use the Player Vicinity but in another room I have hotspots (kind of keyboard buttons with hotspots) very near to each other and then I have to use the Mouse Over method.

Can I change these methods on the fly? using Action Lists ?  

Comments

  • A custom Action or script can do this quite easily.  In the latest AC release, right-click on any label for a field in the Settings Manager, and you'll be able to copy an API reference to that field in the text buffer.  You can then paste it into a custom script/Action, so that you can change it.  Specifically, the code to change to Mouse Over is:

    AC.KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;
  • I have done a custom action following your tutorial on how to do it but the use of AC.KickStarter..... I have not done nor seen a typical example. I followed the Forum on this subject (AC,Starter..) and there are plenty of discussions on how to do all kinds of changes but not a word on changing the Hotpot Detection method.

    I am asking myself if there is a simpler way to do this I don't understand why people wouldn't have the problem that I mention when I have a number of keys/Hotspots very close to each other  and then in the next room the Hotspots are 5-6 meters away and they show up already from this distance. In the former I would use Mouse Over and the latter Vicinity..  

  • A guide to working with AC's KickStarter variables can be found on both the front page of the scripting guide, and in Section 12.7 of the Manual.

    The method I have already given is very simple, and I have even given you the exact code you need to run.  Please understand that there must always be a balance between providing many options through the Settings Manager, Actions, etc - versus empowering the user to do virtually anything with the scripting guide and custom Actions.
  • Yes!, I found out how to use your AC.KickStart and now just by use the Action List which I called ChangeHotspotMethod it works perfectly .

    I only have a question:

    I wanted to use a bool to choose true for Mouse and False for Vicinity but I had to use instead an Int:

         mouseOver = EditorGUILayout.IntField ("1=Mouse, 0 = Vicinity",mouseOver );

    because I could's find a way to use " BoolField" instead of IntField , it seems EditorGUILayout doesn't have any Bool, is this possible?


    But Thanks again

  • edited August 2016
    Inside the ShowGUI function you can use:
    bvar = EditorGUILayout.Toggle("enabled? ", bvar);

    Also, in cases where you want to have a list of options you can use an enum (same as the "popup" var used by AC. Declared:

    public enum OptionList { HP, MP, level };
    public OptionList OptList = OptionList.HP;

    Then inside the ShowGUI function:

    OptList= (OptionList)EditorGUILayout.EnumPopup("Choose option: ", OptList);

    Then you can use it to know what option was chosen using a switch or an if:

    if (OptList == OptionList.HP)

    {
       
    //do your stuff

    }
  • Great! your first line above  cleared my dilemma/ Thanks 
  • Strange thing happened. I created the custom Action List that I call 'ChangeHotspotSetting' following your clues mentioned in the above messages and it works very well in all of my projects except one of them which has been working correctly all the time and I just wanted to add this custom Action here too but it gives me this error :

    Instance of ChangeHotspotMethod couldn't be created. The the script class needs to derive from ScriptableObject.
    UnityEngine.ScriptableObject:CreateInstance(String)
    AC.AdventureCreator:RefreshActions() (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:480)
    AC.AdventureCreator:OnEnable() (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:48)
    UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
    UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

    As I say this project is also short and is working as before by eliminating the custom Action. I have no idea whatsoever why.


  • And the class derives from Action, and is registered in the Actions Manager?  Is it being listed there?  It may be that a simple restart of Unity is able to resolve this.
  • Yes, of course and as I said the same script works with every other project perfectly and it doesn't show in Actions Manager specially because it disappears  I have spent now 2 days and it looks worse because when I copy my 'ChangeHotspotSetting' from one of the working projects into this one even the Adventure Creator top menu in the Unity main screen disappears and so are its Editors!! even if I re-import or reload it from Asset Store it just doesn't show up at all. The only way to recoup is to delete the script, exit , re load the project and now I can see again Adventure Creator menu but no editors so I have to bring them from AC again and everything is fine. I have compared, Managers and use the same actor as 1st person as the other projects to no avail.

    It's a mystery

  • FOUND IT !!

    2 days ago I bought from Asset Store this: "Town Constructor Pack V2" and downloaded it ONLY in the project I've been having problems with. It created a series of errors having to do with there own included Standard Package competing with the Unity supplied one and creating duplicates plus a lot of other incomprehensible errors such as the disappearance of the AC menus.

    That's the reason why my custom script worked with all my other projects because I did not import the Town Constructor Package into them.

    I've had similar problems bringing packages from Asset Store which include scriopts related to the characters and others that collide with the AC .

    For whoever buys this package (which is very nice specially for less than 5 €) just remove their entire Standard Package.


  • Yeah, True that, I've learned to check the list of files well first, because old "standard assets" folders are a pain in the neck. Problem is, most people use the effects in their demos and examples pages, that's why they add them over and over again...
  • @Alverik: Something I wanted to do for the updated 3D Demo, but decided against for that very reason
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.