Forum rules - please read before posting.

Drop an object on Player from Inventory

24

Comments

  • It is changing the Sprite layer with the hotspot on from Default to Ignore Raycast when the scene starts

  • If the object is on the Ignore Raycast layer, the Hotspot will be off. The Hotspot Inspector will mark itself as Off at runtime if this is the case.

    What other components are on your Sprite object?

    If it's the Hotspot itself being directly turned off, you can find the cause by inserting the following into the top of the Hotspot.cs script's TurnOff function (around line 719):

    if (transform.parent && transform.parent.gameObject.name == "Rufus") Debug.Log ("HOTSPOT OFF " + this, this);
    

    That'll flag up the Hotspot being disabled. Click the message in the Console and it'll reveal the full stacktrace. Copy and paste here if it shows.

  • edited December 2021

    Hi, not sure I have inserted the line in the right place in the script - also attached vid showing what else is on the sprite child:

    https://www.dropbox.com/sh/2fuhpubtv8qp7rb/AADCreDVLSAf6oJJdCs8klO8a?dl=0

  • The line is in the right place. Does it show in the Console? If not, it's layer is likely being moved by something else.

    Does changing the layer back to Default manually cause the Hotspot to become interactive?

  • edited December 2021

    Does it show in the Console?

    It doesn't

    Does changing the layer back to Default manually cause the Hotspot to become interactive?

    yes works perfectly when i change it to default

  • Is this a Player that's being spawned into the scene? What's on their root?

  • The player is being spawned through the settings manager. See video of Root settings:

    https://www.dropbox.com/s/936mhbvwnctggoj/PlayerRoot.mov?dl=0

  • The Hotspot whose layer is being changed is the same object as your main sprite. Is it possible that the "Sprite Manager" component on the root is altering this layer?

    The Hotspot doesn't need to be on the same object as your main sprite. You can move both it and the collider to a child of that.

  • edited December 2021

    I removed the sprite manager and lip sync pro to test and it had no effect alas.
    I also moved the collider and hotspot to a child of the main sprite, but it still had no effect.

  • Try making it an immediate child of your root, and uncheck "Turn root object in 3D?" in your Player Inspector.

  • edited December 2021

    Tried that also. Hotspot object still turns to ignore raycast and is not recognised. I tried putting Brain2dSpritesComplex in to (on which my player is based) and the hotspot what not recognised

  • Is there a way to switch the hotspot layer back to default with script? As mentioned earlier, if i do that whilst in play mode the hotspot is recognised

  • Is there a way to switch the hotspot layer back to default with script?

    Try attaching the Remember Hotspot component to it and set its Hotspot state on start to On.

  • I had trouble with my build, adventure creator was in the game, but not appearing as a dropdown in the options. Tried it in my other game and no errors, here is the code:

        using UnityEngine;
        #if UNITY_EDITOR
        using UnityEditor;
        #endif
    
        namespace AC
        {
    
            [System.Serializable]
            public class ActionApplyResolution : Action
            {
    
                public override ActionCategory Category { get { return ActionCategory.Engine; }}
                public override string Title { get { return "Apply resolution"; }}
    
    
    
                override public float Run ()
                {
                    int chosenIndex = GlobalVariables.GetIntegerValue (24); // Replace '0' with your own variable's ID number
                    if (chosenIndex >= 0)
            {
                Resolution chosenResolution = Screen.resolutions [chosenIndex];
    
                Screen.SetResolution (chosenResolution.width, chosenResolution.height, Screen.fullScreen);
                KickStarter.playerMenus.RecalculateAll ();
            }
            return 0f;
        }
    
                }
            }
    

    The path is here, with my other custom action scripts that do show up in actions menu:

    Assets/Sleepytime Village/Scripts/CustomActions

  • Was this meant for another thread?

    If AC is not showing in the top toolbar, then there's a compilation error somewhere. Check the Console window, but keep in mind that the Action above is intended for AC v1.73 or later.

  • edited December 2021
    Ah yes sorry.

    “ Try attaching the Remember Hotspot component to it and set its Hotspot state on start to On.”

    I’m afraid the remember hotspot action didn’t work

    Merry Christmas by the way!
  • The screenshots and test results aren't offering any clues. Unless it's coming from a non-AC script, the only real step is to do a search of any code that sets the object's layer to Ignore Raycast:

    gameObject.layer = LayerMask.NameToLayer (KickStarter.settingsManager.deactivatedLayer);
    

    This occurs in a few places in AC - you'll have to place a Debug.Log statement next to each, to get a Console message that points to which one is being run.

  • Can you help me put this in a full script? And would I just put this on a gameobject in scene? Or as this to hotspot.cs?
  • edited December 2021

    Can you help me put this in a full script?

    There is no script to add - I'm saying to search AC's code for instances of the above. If AC is causing the layer change, that's the line that's causing it.

  • ok thanks, When you say search the code, how and where would i do that?

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.