Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Do not be a big dumb like me and try to put a static GameObject in a static Class

Discussion in 'General Discussion' started by cryophoenix314, Oct 3, 2018.

  1. cryophoenix314

    cryophoenix314

    Joined:
    Oct 3, 2018
    Posts:
    1
    Just click the button on the check box on the corner of the game object and there is a your static game object. I spent 3 days on this people, so to all yee lost souls who would do the same. Heed this advice.
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,914
    why would you

    how

    what

    whhhhyyyyyyyyyyyy did you do this
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,436
    I'm thoroughly confused.
     
    Joe-Censored likes this.
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,039
    Me too, and I bet the OP is, or at least was, also confused.
    The word "static" means very different things in the two contexts you're talking about.

    What were you trying to do? We might be able to make suggestions..?
     
    Ryiah likes this.
  5. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,476
    The static box in the inspector indicates that the GameObject will not be moved, its used for navigation, lighting, physics and the like.

    The static modifier in code indicates that the member is tied to the class instead of the instance.
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    14,523
    With the info you've provided us, which is clearly insufficient based on the statements in the other posts, this advice feels like the blind leading the blind because the meaning behind the word "static" is definitely not the same for classes and GameObjects.

    Like @Kiwasi mentioned setting that checkbox exists to tell the engine that the object won't be moving. An object that never moves is an object that requires fewer calculations every time it is needed for a task (eg rendering, physics, etc).

    https://docs.unity3d.com/Manual/StaticObjects.html

    A static class on the other hand is completely different. Static classes are a way to access method and fields of a class without having to create an instance of the class. Helper classes (eg System.Math) are a typical example.

    https://docs.microsoft.com/en-us/do...ructs/static-classes-and-static-class-members
    https://docs.microsoft.com/en-us/dotnet/api/system.math
     
    Last edited: Oct 3, 2018
  7. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,194
    Maybe we should rename that 'Static' checkbox to 'Doesn't Move'.
     
    Antypodish, Ryiah, hippocoder and 4 others like this.
  8. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,436
    Maybe there can be a Beginner Mode that renames lots of jargon like 'static' to simpler things like 'doesnt move' and 'LOD' to 'far away model'.
     
  9. guneyozsan

    guneyozsan

    Joined:
    Feb 1, 2012
    Posts:
    63
    Please rename it to 'Hodl' :)
     
  10. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,476
    Good idea. Reusing terms is a pain.
     
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,578
    You're definitely the only guy ever to do this.

    Maybe we can have some kind of gameobject namespace system.... ... .. .
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,855
    "Lightmap Doesn't Move"
     
  13. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    14,523
    How about 'Stationary'?
     
    Kiwasi likes this.
  14. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,914
    "The cryophoenix memorial static object button"
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,855
    Since they also like adding icons to things that don't need them these days, I suggest something like this:
    Screen Shot 2018-10-04 at 01.55.44.png
     
    Noisecrime likes this.