Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Bug detection in Unreal Engine projects

Bug detection in Unreal Engine projects

Oct 06 2023
Author:

The PVS-Studio team started adding new diagnostic rules that detect errors typical for Unreal Engine projects. However, we need some help from the game development community. Please share your thoughts on the typical error patterns you would like us to automate the search for.

1069_Unreal_Engine_rules/image1.png

The PVS-Studio analyzer is good at detecting common patterns of typos, logical errors, potential vulnerabilities, and much more. Now the PVS-Studio development teams focus on Unreal Engine.

We started implementing diagnostic rules that find bugs specific to projects built on this game engine.

The first example. We introduced the diagnostic rule that analyzes classes that do not inherit from the UObject type. If such a class has a non-static data member as a pointer to a type that inherits from UObject, then it is not correct.

class SomeClass
{
  ....
  UObject *m_ptr;
  ....
};

The Unreal Engine garbage collector can destroy an object addressed by the m_ptr pointer. Read more about this diagnostic rule: V1100.

The second example. This diagnostic rule identifies declarations that do not comply with naming conventions for Unreal Engine projects. The compliance with the conventions is required for the correct operation of the Unreal Header Tool.

  • Classes that inherit from UObject are prefixed by 'U';
  • Classes that inherit from AActor are prefixed by 'A';
  • Classes that inherit from SWidget are prefixed by 'S';
  • And so on. If you'd like to learn more, see the description of the V1102 diagnostic rule (will be added in October — with the PVS-Studio 7.27 release).

We are just getting started. We will collect error patterns similar to the ones above and implement their detection in the analyzer. The thing is, without the help of the GameDev community, our work will take ages. Since we don't develop games ourselves, the pattern collection will be random at first.

We easily get inspired to make general diagnostic rules. Why is this not the case with Unreal Engine?

There are many articles and books on common errors. These errors are easy to collect. We also get a lot of ideas from our user support work.

This can also be the case for the UE-oriented diagnostic rules. Users will find bugs and suggest ideas on what else to look for. To start the process, all we have to do is nudge it. That's why this note came about.

Leave comments with your ideas on what bugs we should be looking for!

I invite you to think about what bugs you regularly find during code review, even though they can be detected automatically, and write about them in the comments. In fact, static analysis is a kind of automated code review.

We are looking forward to hearing your interesting ideas. Thank you!

Popular related articles


Comments (0)

Next comments next comments
close comment form