Forum rules - please read before posting.

Sprite Visibility

edited June 2015 in Technical Q&A
This should be an easy question but no matter how hard I try, I cannot start a scene off with a sprite already invisible. I've added a 'Remember Visibility' script to the sprite and it's still visible upon running. 

I've been going round and round with this and just can't fix it yet I know it'll be so simple?

Comments

  • edited June 2015
    UPDATE: Ok, I can get them to disappear by changing the visibility to OFF, but upon leaving the scene and returning the sprites are back again, even with Remember Visibility set.

    Remember Visibility seems to have no effect on Sprites (I use the sprites for inventory items that can be picked up.)
  • The RememberVisibility component should indeed save the visibility of a sprite.  Is it attached to the same object as the Sprite component (obvious question I know), and did you check "Affect children" or not?
  • It is indeed attached to the sprite component and I've tried it with 'Affect children' ticked and unticked, to no avail :(
  • edited July 2015
    I'm worried, you didn't add invisible component to you sprite and to your children if there are any :)
  • I tried that but it made it made no difference. I don't have it added now, no.
  • The 2D demo uses this feature for several objects - e.g. WormGround, and they work fine.  Check that they also work for you - save the game, pick up the worm, and save again.  Loading the two saves should show/hide the worm each time (be sure to add the 2D demo to the build settings first)
  • I can't run the demo as even after importing a fresh install of AC, the 2D demo won't function correctly because the tin robot just falls through the ground as soon as the scene begins.
  • edited July 2015
    Also, setting an object's RememberVisibilty at Start to OFF isn't working - the sprite shows as soon the scene starts. 

    The hotspots are turning on and off fine, it's the sprites that aren't.
  • I've worked it out:

    The RememberVisibility will only work on a sprite if Limit Visibility Script is unchecked. If it's ticked then the RememberVisibility doesn't work.

    Could this be a problem?
  • For the moment.  I will look into a fix.

    For the record, to run the 2D Demo, you first have to load the 2D Demo Managers, by going up to the top toolbar and choosing Adventure Creator -> Getting started -> Load 2D Demo Managers.
  • Thanks Chris. Yes, this is now beginning to cause problems :(
  • Hi Chris, me too, I've some problems with sprite visibility.

    1. I've run the 2D Demo from AC "Getting started".
    2. I've add Park scene in "Build Settings".
    3. I've saved at the start, after introduction.
    4. I've taked the worm and I've saved again.

    If I load the first save the worm is invisible.

    Many thanks in advance for your help.

  • @Antonio I cannot reproduce such an issue. The "WormGround" object in the Hierarchy has a Remember Visibility component attached which should correctly save/load the visibility state.

    Please open up a new thread with full details (including AC/Unity version numbers and platform), so I can see what's what.

  • Thank you so much Chris, for your fast answer.
    I've opened a new thread.

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.