Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is this possible in Unity?

Discussion in 'Editor & General Support' started by ModernCGI, Mar 1, 2012.

  1. ModernCGI

    ModernCGI

    Joined:
    Dec 7, 2011
    Posts:
    56
    Hi was wondering. I cannot think of the proper term but basically in the Unity Engine can you have it where LOW poly buildings can be generated on the fly when you get to a certain distance? It hard to explain so let me tell you what I mean.

    A user is running straight.
    He has 5 to 6 buildings spawn in front of him JUST as the become clear through the fog.
    If he runs past these buildings they disappear when he is a certain distance away from it. Newer ones spawn.

    I am trying to get the effect of a never ending world. You could compare it to that app game where blocks are generated as they come into view and they disappear when you cannot see them anymore.

    Sorry if I am not clear with my question. Let me know if there is a part you do not understand. Thanks!
     
  2. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    You're talking about instantiating and destroying buildings.

    Yes, you can do this.

    Just make a script that does Instantiate() at a position in front of the player, and Destroy() in a OnBecameInvisible() function or when it gets too far away.
     
    Last edited: Mar 1, 2012
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    In your case, you dont need to instantiate and destroy buildings every time.
    You just need to create enough buildings to cover visual area and hold them in an array of sort and reposition the buildings infront of your player after they had to disappear continuously.
     
  4. ModernCGI

    ModernCGI

    Joined:
    Dec 7, 2011
    Posts:
    56
    Ok thanks! This would help a lot.