Tuesday, August 16, 2022
HomeGame Developmentunity - Most effective strategy to load property primarily based on participant...

unity – Most effective strategy to load property primarily based on participant settings?


I want to know some higher coding patterns to load property primarily based on participant settings. Say that customers are allowed to pick 1 of many skins for a weapon. Now after I load that weapon object, I need the property for that pores and skin to be loaded as an alternative of the default.

My query is: what is an effective coding sample to retailer the person’s pores and skin alternative, and to learn/use this saved information to programmatically load a prefab or texture later?

Proper now, what I’ve is a scroll view with buttons that present every distinctive pores and skin. When the button is pressed, it saves the pores and skin texture’s file identify to JSON. Then, later, after I wish to work out what to make use of, I learn that discipline from JSON and name Sources.Load() on the file identify.

Is there a greater manner to do that? That is very handbook and error susceptible since I’ve to specify the feel’s file identify in my code for every button. Proper now I am attempting to seize the feel’s file identify by way of Picture.sprite.identify, however this additionally has a stage of handbook work concerned. It requires realizing which subdirectory of the Sources folder the sprite is in.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments