Search Unity

I want to change the sprite of a Gameobject that is in another scene

Discussion in 'Scripting' started by lakiid373, Jul 20, 2019.

  1. lakiid373

    lakiid373

    Joined:
    Jun 11, 2019
    Posts:
    5
    Hi, so i have a menu scene(menu scene) where i need to change the skins(sprites) of the game object called player in another scene.First i need to get the game object in the another scene then get the component called
    spriterender. Help me plz,thank you in advance,
     
  2. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,075
    How big is your game and how necessary is it to actually keep the scenes separate? I could understand if this was in 3D but it seems to me if you're only dealing with sprites then it would make more sense to keep it all in one scene and do some sort of transition effect to trick the player into thinking a level or scene has changed.

    Does that make sense? It means less headaches for you as a programmer and a gamer isn't going to notice the difference. I've been surprised myself at how much we normally would think is an actual game mechanic is nothing more than optical illusion trickery by game developers.
     
  3. lakiid373

    lakiid373

    Joined:
    Jun 11, 2019
    Posts:
    5
    well u see its a bit more complicated the game consists of 7 scenes(and 1 more is menu) each has a random lvl generator in it with a lot of skipts. I was thinking about changing the sprite of a the prefab player (if its possible) and then incorporate in the generator (witch consists of a lot if instantiete commands of other prefabs).But this i think will not work because how it can change the sprite of a prefab that insnt loaded in the scene.... or if it can change the sprite when its in the prefabs folder in untity...idk.Or i can make in every scene a lot of functions,then somehow call this functions from menu scene to change the sprite of the game object. I Know its complicated this is way i am asking .........