Finding in Construct 3 projects

2
Official Construct Post
Ashley's avatar
Ashley
  • 13 Feb, 2017
  • 977 words
  • ~4-7 mins
  • 4,194 visits
  • 0 favourites

Construct 2 users often design very large projects. When things start to get complex, it can be hard to answer questions like "where is this object used?" or "can I delete this?". So for Construct 3 we redesigned some features, and added some new ones too. Here's an overview of the new tools we're providing to review your projects and help make sense of them.

Improved event search

Searching events in Construct 2 was fairly basic: it essentially filtered events down to those matching the search term. This wasn't always the clearest way of presenting matches. To improve this, we've redesigned the event search feature. First of all there are new options such as the ability to search through the whole project, and match case.

Once you run the search, the results are displayed in a separate Find Results list. This is another bar which you can dock to the interface, like the Project Bar or Layers Bar. This lists all the matching results with highlighting and information about the location of the match. It will also list results from the entire project if you so chose.

Event search results in Construct 3. Click to expand.

The search results update automatically if you delete content from the project. Alternatively later on you can manually redo the search to update the results. Note the events themselves aren't filtered, so you can see everything in its original context.

Searching for text in an event sheet is a quick and easy, and as you can see also returns results from comments, event groups and expressions. However this is not always particularly helpful. For example you may want to look for an object name, but get a lot of results in comments, or unrelated strings in expressions. Worse, you may find that searching for an object name still matches other object names. For example if you search for Sprite, you still get results for Sprite2 because that name also includes the search term Sprite.

These results show a mix of 'Sprite' and 'Sprite2'.

It is awkward to pick through results like these. To solve this problem, we designed a new feature.

Find All References

There is a new type of search you can do: Find all references. This finds the list of references to a given object, object behavior, instance variable, plugin or behavior. It covers the entire project, and the results are precise: if you Find all references for the object "Sprite", you get only references to that specific object.

Even if the term "Sprite" appears in event groups, comments, other object names, or anywhere else, Construct 3 knows that's not a match. Internally, this uses a redesigned architecture to identify references to elements of the project. For example Construct 3 can distinguish between the text "Sprite" in the string "Click this sprite", an unrelated reference in the expression Sprite2.X, and an actual object reference in the expression Sprite.X.

In the returned list, every single result is a reference to the actual object that was searched for. There are no unrelated matches like there were with text search.

This is invaluable for quickly reviewing projects and finding where an object is used.

You might also have spotted that Find all references also returns results from layouts. The top result indicates there is 1 instance of Sprite on Layout 1. This helps you find where instances are actually used across layouts as well. When you double-click a layout result, the layout opens, selects those instances, and scrolls and zooms the viewport to fit them all in the window. For example here's what happens when you double-click the layout result when doing 'Find all references' on the monster sprite from the Ghost Shooter tutorial:

Notice how the Layout View fits all the monsters in the window. If the objects were used on a different layout, there would be a second layout result in the list. This makes it incredibly easy to skip between layouts and get a quick overview of everywhere an object is used.

Other kinds of search

Find all references can also:

  • Search by object behavior, returning a list of results to a specific behavior (e.g. everything referencing the player's Platform behavior)
  • Search by instance variable, returning a list of events that reference a specific instance variable (e.g. everything referencing the Monster health instance variable)
  • Return a list of which families an object belongs to
  • Search by an entire plugin or behavior, for example finding all references of the Tiled Background plugin

Searching for an entire plugin or behavior can be done from a new dialog which lists all the addons used by a project, and which object types use them:

This makes it easy to see which plugins, behaviors and effects you've used in a project. The results also list every object in the project using that plugin. Secondly you can quickly identify unused plugins with no references and delete them.

Conclusion

The improved event search and the new Find all references search are designed to make it very easy to review projects. It's also an incredibly useful tool for quickly looking around someone else's project, identifying how and where they have used things. The results of Find all references are precise enough that you can be confident that the results are comprehensive, that every result matters, and nothing else has been included by accident. Reviewing across layouts also helps remind you what you've placed, and where. This helps you answer questions like "where is this object used?" quickly, easily and with confidence.

Catch-up

Missed our earlier announcements? Here's a list of all the news about Construct 3 so far:

Subscribe

Get emailed when there are new posts!