Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Architecture for replacing multiple of duplicate Settings conditionals over code base

Discussion in 'Editor & General Support' started by joesobo, May 27, 2020.

  1. joesobo


    Sep 6, 2018
    Hope the title makes sense. Basic premise is that I have a general settings class that controls the rest of my code at run time. For example if useParticles is false then no particles will spawn. The problem I'm having is that every time I want to create a new particle I have to find the settings object and check to see if its useParticles is active and only then spawn the actual particle. I know there definetly better ways to do this (I have if statements everywhere now!). Is there any form of programming architecture I should be using so that the settings class can send signals to each individual particle, instead of the other way around where whatever spawns the particle sends a signal to the settings class.