Forum rules - please read before posting.

Switching game art at runtime

Hi,

Do you think that is doable switch game art at runtime?

I mean, for example, something like MI special edition, Day of the tentacle remastered: Switch between pixel art and cartoonized (for example).
If not a switch on any time, implementing this change at game starting. Same game with two art styles. (of course about two art styles but keeping object locations, hotspot positions, etc 

Comments

  • I believe it is possible, using a global var and an event that triggers the replacement of the images in the sprite renderer component (assuming it's a 2D game) - this would work anytime. 




  • Certainly it's possible, but you'd likely want to make use of a little custom scripting to make your life easier.

    Recording the current state in a Boolean Global Variable would be the first thing to do, and then you could make an Active Input (see Manual Section 2.14) to toggle it's state on and off.

    Place your artwork inside Animator components as animations (i.e. one animation plays one art style, another animation plays the other).  You could then wire up a Boolean parameter within the Animator to choose which one to play - and this would also allow you to have transitions if you wanted.

    Then tag all such Animator objects under a dedicated new Tag (e.g. "Switchable Art"), and then write a script / custom Action that runs after the Global Variable is changed, which sets the Animator boolean parameters to match the value of the global variable, e.g.:

    bool globalVariableValue = AC.GlobalVariables.GetBooleanValue (2);
    GameObject[] obsToChange = GameObject.FindGameObjectsWithTag ("SwitchableArt");
    foreach (GameObject obToChange in obsToChange)
    {
        obToChange.GetComponent <Animator>().SetBool ("MyAnimatorBool", globalVariableValue);
    }


    Where "2" is the ID number of the global variable.  You'd also want to run this Action in your OnLoad / OnStart Cutscenes so that it updates the art when a scene begins.
  • Thanks for show me the way to go!

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.