Skip to content

Commit

Permalink
Made the import process a bit more simple
Browse files Browse the repository at this point in the history
  • Loading branch information
treacher committed Oct 2, 2015
1 parent 36b15e0 commit 132ef90
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
Binary file modified Assets/ExampleScene.unity
Binary file not shown.
9 changes: 9 additions & 0 deletions Assets/Scripts/FrispSocial.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using System.Collections;

public class ExampleShare : MonoBehaviour {
public class FrispShare : MonoBehaviour {

public void shareScreenShot() {
StartCoroutine (PostScreenshot());
Expand All @@ -14,15 +14,15 @@ public class ExampleShare : MonoBehaviour {
int height = Screen.height;
Texture2D tex = new Texture2D( width, height, TextureFormat.RGB24, false );
// Read screen contents into the texture
tex.ReadPixels( new Rect(0, 0, width, height), 0, 0 );
tex.ReadPixels(new Rect(0, 0, width, height), 0, 0 );
tex.Apply();

#if UNITY_IPHONE && !UNITY_EDITOR
FrispAppleSocial.Instance().ShareImage("Testing", tex);
FrispAppleSocial.Instance().ShareImage(FrispShareConstants.MESSAGE, tex);
#endif

#if UNITY_ANDROID && !UNITY_EDITOR
FrispAndroidSocial.Instance().ShareImage("Title", "Testing", tex);
FrispAndroidSocial.Instance().ShareImage(FrispShareConstants.TITLE, FrispShareConstants.MESSAGE, tex);
#endif

Destroy(tex);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Scripts/FrispSocial/FrispSocialConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using UnityEngine;
using System.Collections;

public class FrispShareConstants {

public const string TITLE = "Title";
public const string MESSAGE = "Message";

}
12 changes: 12 additions & 0 deletions Assets/Scripts/FrispSocial/FrispSocialConstants.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 5.0.0f4
m_EditorVersion: 5.2.1f1
m_StandardAssetsVersion: 0
Binary file added ProjectSettings/UnityAdsSettings.asset
Binary file not shown.
Binary file added ProjectSettings/UnityAnalyticsManager.asset
Binary file not shown.
34 changes: 2 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,9 @@ If you would like to make any changes or update the android layer of the asset y
### Installing into your own project

* Download the [asset](https://github.com/frispgames/frisp-social-unity-asset/blob/master/package/frisp-social.unitypackage) and import it into your unity project.
* Create a class that takes a screenshot of the game and then use the API provided with the asset to share it. See the below class as an example:
```CSharp
using UnityEngine;
using System.Collections;
* Update the ``Scripts/FrispSocial/FrispSocialConstants.cs`` file to contain the message and title you wish to use.
* Connect the functions that are in the ``Scripts/FrispSocial/FrispSocial.cs`` class with actions in your game.

public class ExampleShare : MonoBehaviour {

public void shareScreenShot() {
StartCoroutine (PostScreenshot());
}

private IEnumerator PostScreenshot() {
yield return new WaitForEndOfFrame();
// Create a texture the size of the screen, RGB24 format
int width = Screen.width;
int height = Screen.height;
Texture2D tex = new Texture2D( width, height, TextureFormat.RGB24, false );
// Read screen contents into the texture
tex.ReadPixels( new Rect(0, 0, width, height), 0, 0 );
tex.Apply();

#if UNITY_IPHONE && !UNITY_EDITOR
FrispAppleSocial.ShareImage("Testing", tex);
#endif

#if UNITY_ANDROID
FrispAndroidSocial.instance().ShareImage("Title", "Testing", tex);
#endif

Destroy(tex);
}
}
```
### Troubleshooting
#### Android:
* INSTALL_FAILED_CONTAINER_ERROR: When exporting the project to Android Studio change:
Expand Down
Binary file modified package/frisp-social.unitypackage
Binary file not shown.

0 comments on commit 132ef90

Please sign in to comment.