Forum begins after the advertisement:


[General] KingBibleProjectile Gets Area of 0

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [General] KingBibleProjectile Gets Area of 0

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16393
    Sean
    Level 11
    Participant
    Helpful?
    Up
    1
    ::

    Hi,

    I’m unsure if anyone else is experiencing this, but my KingBibleProjectile script keeps getting an area of 0. If I hard code “startScale = new Vector3(area, area, 1);” to “startScale = new Vector3(1, 1, 1);” everything works perfectly, so all the issues seem to stem from area being 0.

    I added “Debug.Log(area);” all throughout the Start function in the Projectile script it’s inheriting from and area is always successfully set to 1 all throughout the method, but immediately after “base.Start()” in the KingBibleProjectile’s Start function, “area” logs as 0.

    I can’t find any other areas (no pun intended) where area would change. Is there something about inheritence I don’t know where I can’t access the parent variables as easily as I thought?
    Even in the debug inspector, area is 0.

    Kind Regards,
    Sean

    has upvoted this post.
    #16394
    Sean
    Level 11
    Participant
    Helpful?
    Up
    1
    ::

    My mistake…

    I forgot to remove the “float” declaration for area in Start, as mentioned in the King Bible’s tutorial so it was creating the variable locally for the Start function and not setting the variable for the entire class.

    If there’s a way to delete posts, please let me know, so I can hide my shame.

    has upvoted this post.
    #16403
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    No shame in this Sean. Sometimes writing out your own issue helps you to solve the problem eventually, because writing about it forces you to think about the problem in more detail.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: