Forum rules - please read before posting.

Explanation for use of highlight Custom Events

Hi,
As an added effect to my 3D Player Menu (see other thread) I have the characters lighting up when we hover over them, and displating their name.
I would like a "pillar of light" to also appear.

I have a "pillarof light" prefab. So I was hoping to use the Custome Events feature of the highlight script to activate a prefab and deactivate it when user rolls off.

When I tried this, I dragged my Light beam object into the slot, and selected GameObject:Set active. and clicked the tick box.

When the game runs, this deactivates... Im obviously not understanding the correct operation of this feature, but it is, unfortunately under- explained (not at all) in the manual.
image

Comments

  • edited April 2017
    It works the same as Unity's own Event Trigger. You've set it up almost correct, but your OnHighlightOn event is never going to fire, since it's Off (left drop down). Make sure to select Runtime Only for both events (in this case you want the code/command to run only when the game is playing, not while in-editor).
  • edited April 2017
    hi markfrancombe,

    I think the manual has the right level of detail, it cannot be a 1000-pages encyclopedia. ;) Regarding your problem, have you tried changing this setting of the callback in the UI? (see screenshot)

    image
    image





  • Thanks guys,
    Sorry wasnt totally clear:

    See my OP..

    When I tried this, I dragged my Light beam object into the slot, and selected GameObject:Set active. and clicked the tick box.
    When the game runs, this deactivates... 

    What I meant was that the tick box was checked AND Runtime and Editor was selected in the drop-down. But when the game starts, they BOTH become deactivated, as shown in the image...
    Sorry I was unclear...

    @ciaps thanks for you opinion on the manual, I agree of course. What I would like is a simple list of all actions, with one line about each option. Exactly like PlayMaker does... with PM you can even click within the action and it takes you to that wiki page (I think its a wiki- easier for them to maintain than a pdf manual too) 
    but Hey Id rather the devs spent time devving than manual writing, when the folk on the forum are so cool and helpful!
  • edited April 2017
    Ummm. well, dealing with enabling and disabling of objects tend to be problematic. Maybe it's an issue with the starting state of the object you are trying to manipulate? (objects which start disabled will always cause issues, that's a Unity thing). 

    Is the prefab a ParticlesSystem or a model? You could try manipulating the components themselves instead of just enabling and disabling the whole object. If it's a model you could have the object renderer hide using the Object:Visibility Action, or if it's a particle system you could use the ParticleSwitch.cs script in conjunction with the Object:Send Message action (just put the script on the prefab and use the Object:SendMessage with either TurnOn or TurnOff).
  • unfortunately under- explained (not at all) in the manual.

    The Highlight component, and the ability to rely on custom events - is covered in Section 5.3.

    with
    PM you can even click within the action and it takes you to that wiki
    page (I think its a wiki- easier for them to maintain than a pdf manual
    too)

    AC has a similar feature - click on the Manual icon at the top of any AC component, and you'll be taken to the relevant page in the scripting guide.  The entry for the On Highlight On event can be found here.

    The issue is actually due to the inability for Unity to allow for the setting of event parameters in a custom UI.  Notice that when the game begins, the checked state of the "On Highlight On" event is disabled.

    The workaround is to attach a simple script to the object with separate On/Off functions that do the activation/deactivation through script.  @Alverik is quite right, though - Unity can often have trouble referencing deactivated objects, so you'd be better off enabling/disabling components within the GameObject itself.
  • Thanks guys!
    Alverik OK I didnt know that about Unity being bad at disabled objects...I didnt quite understand your first suggestion that best pertains to me, my light beam is an object not a particle... but it gave me the idea to NOT disable the parent gameobject, but to try disabling the actual model (just a plane with a texture on it... actually using a particle shader, just for looks)

    Dragging the PLANE into the highlight custom event slot, then disabling it, and using GameObject:SetActive.. worked... now Ive made a pretty nice menu thanks to you!

    @ChrisIceBox Aha.. ok i see the manual icon now... but the content it links to im waaaay too stupid for... was just looking for a actions manual. Anyway now I get it... enabling components is the way to go... not the actual objects.

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.