Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using unity and C# Create a StreamReader member variable for the script. Create an empty method called LoadGems( ) that takes in a string that

Using unity and C#

Create a StreamReader member variable for the script.

Create an empty method called LoadGems( ) that takes in a string that represents the file name. Don't hard-code it to "gem_data.txt". Inside of that method, bring the StreamReader variable to life, passing it the file name .

Below that, create a string called "dataline" and initialize it to the empty string ""

Immediately afterwards, read a line of data using the StreamReaders ReadLine() method.

This returns you the next available line in the file, so put it into "dataline".

While (dataline != null), print out dataline using Debug.Log() Inside that loop, read the next line of data.

At the bottom of the method (after the loop), close the file using sr.Close();

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago