Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Making Ghost Wall like sims

Discussion in 'Scripting' started by Xatu1992, Mar 22, 2015.

  1. Xatu1992

    Xatu1992

    Joined:
    Mar 22, 2015
    Posts:
    13
    If you have ever played Sims you will know what I am on about. I have a grid and I have my build area, I can make it so when i hover over buildzone it'll change the block to a different color. Anyone got any ideas how Id go about making a ghost wall that appears and is transparent then if Fire1 is clicked it places it on the spot the G/wall appears.

    I'm open to suggestions.
     
  2. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    There are three solutions I've been using for this:

    1. Have a wall that is made of two parts of materials and with some toggle make one of the material transparent.
    2. Have two different wall references to a single wall and switch them.
    3. If you want to make a wall transparent for only part of where for example player is going use 1 or 2 method + send a raycast to a screen center and hide/switch walls that hits with raycast.
     
    Xatu1992 likes this.
  3. Xatu1992

    Xatu1992

    Joined:
    Mar 22, 2015
    Posts:
    13
    1. sounds like it should do what I want to do for the time being. thanks
     
  4. MrPriest

    MrPriest

    Joined:
    Mar 17, 2014
    Posts:
    202
    I am honestly asking - why not just use a transparent/diffuse shader and change the opacity levels?
    Is having two materials, or two objects, better performance/resources-wise?
     
  5. Xatu1992

    Xatu1992

    Joined:
    Mar 22, 2015
    Posts:
    13
    So have my block spawn where the build mode is and then make it so collider is turned off and it goes between two materials, then once user selects to build it turns the block on with whatever they wanted there you mean? good idea but so many flaws...
     
  6. MrPriest

    MrPriest

    Joined:
    Mar 17, 2014
    Posts:
    202
    Ah, I did not mean that you should create a few objects, it is one of Proandrius suggestions (number 2, isn't it?)
    I was just asking if his method is better than just using a transparent-capable material, and play with opacity, rather than create two objects.
     
  7. Xatu1992

    Xatu1992

    Joined:
    Mar 22, 2015
    Posts:
    13
    For final optimization id say it is useful yeah am just doing the framework so the team I'm working with know what the final product will do.