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

Automatically resizing walls

Discussion in 'Scripting' started by Barft, May 18, 2015.

  1. Barft

    Barft

    Joined:
    Apr 9, 2015
    Posts:
    84
    Hi guys, i'm working on a game where you got a ball and it must go in a hole ,and I have made invissible walls so the ball can't roll of the platform. But its not resizing the screen so the ball can role out of the screen what i not want. How can i make this automatically resizing?
    (Btw, i'm new to programming in C# and unity, i use it now for 4 months). Thanks!
     
  2. OlavoDias

    OlavoDias

    Joined:
    May 2, 2015
    Posts:
    13
    I don't know exactly if I understand the problem. If you created invisible walls just to keep the ball into the platform, I don't understand why they should resize. Does the platform size change? If so, then you would have to manually resize the wall thru script.

    How did you create those invisible walls? Does that have a Box Collider component attached?

    Since they are invisible, I'd say you should make big walls .. .and make the box collider big in Length too, because if it is too thin, depending on the ball speed, Unity can fail and not detect the collision. You can change the collision detect mode, but it can impact performance.