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

Scripts not working when applied to Probuilder Objects

Discussion in 'World Building' started by The_Nerd_Sherpa, Jan 17, 2019.

  1. The_Nerd_Sherpa

    The_Nerd_Sherpa

    Joined:
    Dec 11, 2018
    Posts:
    57
    Using:
    Unity 2018.3.0f2
    Probuilder 3.0.9

    I created a door using Probuilder and created an open-door and close-door animation. Then created a script to allow the player to manually open/close the door. In game nothing happens. I added print "door opened" to the console. I'm seeing the comment in the console, so I know the script is running. I'm not getting any errors. It's just not working.

    When I create the same door with standard 3D cubes and apply the same animations and script, the animations and script work just fine.

    Am I missing something?

    Thanks
     
  2. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi! Can you double-check that your door is not "Static"? That's the checkbox in the upper right of the Inspector.
     
  3. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    More info: PB objects are (in 309 and previous) set to "Static" by default, because PB objects are generally used for static level geometry. However, we've noticed (ie, this thread, and others) that people can be confused by this. So, we're switching over to not setting Static by default in PB4 and up :)

    If you do prefer Static, or various other changes to default, you can set the defaults in the ProBuilder preferences (Edit > Preferences > ProBuilder).
     
    gonull-dostu and The_Nerd_Sherpa like this.
  4. The_Nerd_Sherpa

    The_Nerd_Sherpa

    Joined:
    Dec 11, 2018
    Posts:
    57
    Oh man, if that's all it is that will be great. I'll take a look tonight.

    PB triggers work, so I figured I was missing something.
     
    gabrielw_unity likes this.
  5. The_Nerd_Sherpa

    The_Nerd_Sherpa

    Joined:
    Dec 11, 2018
    Posts:
    57

    I did get a chance to test this out over the weekend. It was the Static checkbox. After researching what that is for (calculating reflections among others) I dont think unchecked should be the default. I think your original logic is sound. Most things that we use PB to create, are static.

    If you made unchecked the default, I for one would forget ... and would lose my mind trying to troubleshoot why my building isn't showing up in the reflection.

    Less often I would have to uncheck Static if it was already checked for me, as opposed to having to check it all the time to make sure that the object gets included in the calculation.
     
  6. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Thanks for the thought! Yep, performance-wise, "Static" is best, but default Unity objects never have this checked, so it creates confusion...no happy answer :p

    ...Except there is! You can change the default for ProBuilder via "Edit > Preferences", click "ProBuilder", then customize the "Mesh Settings" area :) Hooray!
     
    The_Nerd_Sherpa likes this.
  7. The_Nerd_Sherpa

    The_Nerd_Sherpa

    Joined:
    Dec 11, 2018
    Posts:
    57
    [QUOTE="...no happy answer :p

    ...Except there is! You can change the default for ProBuilder via "Edit > Preferences", click "ProBuilder", then customize the "Mesh Settings" area :) Hooray![/QUOTE]


    hahaha! you guy's are great!
     
    gabrielw_unity likes this.