Easier null checking in Unity?

The Problem

TryGetComponent

.net Extension Method

Problem 1. Error in the wrong place

at Assets/CBC/Scripts/Helpers/MonoExtensions.cs:16)
SeatShuffle:Start () (at Assets/CBC/Scripts/Player/SeatShuffle.cs:31)

Problem 2. Repeated error messages

CallerMemberName and/or default message

var fakeComponent = this.GetComponent<SphereCollider>();
public static T GetComponentExt<T>(this Component component  ...

Unity, VR, Enterprise and .Net Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Component and Bean Annotation

Create a Weather App in React.JS

Completing 30-day vanilla JS projects in 30 days — Part 4

HTML5 Top Features

How to Implement Pinch to Zoom on the Browser in Angular

Angular API-Client with Spring Boot API in one minute

An Introduction to the Linked List Data Structure Using Javascript

Git pre commits hooks and Continous Integration / Continous Deployment.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Paul Marsh

Paul Marsh

Unity, VR, Enterprise and .Net Developer

More from Medium

Day 101: Character Animation Part 4

Skeleton Damage Animation

2.5D Platformer: Moving Platforms

Passion For Programming? Where does it come from?