Forum rules - please read before posting.

Tint Map Lighting

I tried to use the tint maps to add some dynamic lighting to my areas to cast shadows and have the characters affected by the different light sources around the area. However, trying out the 2D demo tint map texture, all of the characters and objects that have the tint map component in their sprite just vanish when the game is running.

I have followed the tutorial to the T, but this keeps happening. I have brought this up in the discord and this has not been seen before.

«1

Comments

  • Does the Tint Map's Colour modifier have an alpha value? What about the texture you're using? Please share more details in the form of screenshots.

  • I am using the default 2D texture, and the colour modifier was set to alpha. I have set it back and the sprites are now being changed to the selected colour.

    For clarity, with tint maps, the white areas in the texture represent when the colour will not be modified, and the colour modifier controls what colour the sprites in the dark region will be changed to?

    Thanks.

  • Also, is it possible to use multiple tint maps by placing them as children in the default scene tint map?

  • For clarity, with tint maps, the white areas in the texture represent when the colour will not be modified, and the colour modifier controls what colour the sprites in the dark region will be changed to?

    Pure white will leave the sprite unmodified, yes.

    Also, is it possible to use multiple tint maps by placing them as children in the default scene tint map?

    A Follow Tint Map component can only refer to one Tint Map for its colour change. You could write a custom script, however, to multiply various Tint Map colours together to set the value of the scene's "default" one, i.e.:

    Color myNewColor = Color.white;
    // (Iterate through other Tint Maps and multiply their colors into myNewColor)
    KickStarter.sceneSettings.tintMap.colorModifier = myNewColor;
    
  • Thanks!

    On the subject of integrating scripts into AC. How do you link a custom script to an AC menu element such as a label?

  • In what way do you want to integrate it, exactly? A label can accept variable tokens, e.g. [var:0] to replace its contents with a variable value (see the Manual's "Text tokens" chapter).

    To override the behaviour when clicking on a clickable element e.g. a Button, you can hook into the OnMenuElementClick event (see the Manual's "Menu scripting" chapter).

  • I have a clock script ready to go, but I just need a way to link it to a menu label element to display.

    The code is here.
    http://pasteall.org/1457811/csharp

  • edited January 2019

    You can set the clock's string output to the value of a String variable, e.g.:

    AC.GlobalVariables.SetStringValue (10, clock.GetTime().ToString());
    

    Where "10" is the ID number of a global String Variable you've created (ID numbers are listed to the left of their names in the Variables Manager).

    See the Manual's "Variable scripting" chapter for more on this.

    Once you're updating the Variable's value each frame, you can then either use a text token in the Label, i.e.:

    [var:10]
    

    Or just set the Label's Label type property to Global Variable.

  • I've set the GlobalVariable code inside the start procedure, and the variable in AC is not picking it up.

    Is this right?

    http://pasteall.org/1458051/csharp

  • You're only setting it once in your Start() function.

    It'll only update when you tell it to. If you want it to update every frame, you'll have to call it in your Update() function.

  • I've set it in the update function and for some reason, it is still not connecting. I tested the references to the 4th var and it does recognise the var being referenced.
    http://pasteall.org/1459686/csharp

  • "Still not connecting" in what way? What happens, exactly?

    Is the variable's value correct in the Variables Manager if you check Show realtime values?? How have you set up your Menu to display the value?

  • Nothing displays

    My setup looks to be ok.

  • Don't link it to a custom script - you're not using events to set its value, as covered in the Manual chapter refererred to by the Manager.

    I can't recreate - this works for me. What are your AC and Unity version numbers, and what's showing in the Console?

    Let's see full screens of your Managers - I can't reproduce accurately if you crop them.

  • edited January 2019


    This is my menu manager right now. and the current state of the variable. If you were able to get the clock working please let me know. The console is mentioning nothing about the menus.

  • You're still cropping - the Pause menu's properties are not all showing.

    Yes, this works just fine for me. A package with Managers and a scene: http://iceboxstudios.co.uk/stuff/8379.unitypackage

  • The link you sent sends me to nothing.

    Sorry about the crop, here are the Menu Properties.

  • Sorry, saved the link and installing the managers now.

  • Tested it and found the problem.

    It's displaying fine now. Thank you!

  • For the benefit of anyone reading in the future, what was the problem?

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.