playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - 9TOFRIDAY

Pages: [1]
1
Playmaker Help / Facebook Audience Network custom script help please
« on: February 18, 2016, 05:57:27 AM »
Hey peeps

so I'm trying to write custom action for Facebook audience network.

here is the script I'm trying to replicate in a playmaker action:
Code: [Select]
using System.Collections;
using System.Collections.Generic;
using AudienceNetwork;

[RequireComponent (typeof(CanvasRenderer))]
[RequireComponent (typeof(RectTransform))]
public class NativeAdTest : MonoBehaviour
{
    private NativeAd nativeAd;

    // UI elements in scene
    [Header("Text:")]
    public Text title;
    public Text socialContext;
    [Header("Images:")]
    public Image coverImage;
    public Image iconImage;
    [Header("Buttons:")]
    public Text callToAction;
    public Button callToActionButton;

public Text errorHandle;


    void Awake ()
    {
        // Create a native ad request with a unique placement ID (generate your own on the Facebook app settings).
        // Use different ID for each ad placement in your app.
NativeAd nativeAd = new AudienceNetwork.NativeAd ("319403784850492_327199570737580");
        this.nativeAd = nativeAd;

        // Wire up GameObject with the native ad; the specified buttons will be clickable.
        nativeAd.RegisterGameObjectForImpression (gameObject, new Button[] { callToActionButton });

        // Set delegates to get notified on changes or when the user interacts with the ad.
        nativeAd.NativeAdDidLoad = (delegate() {
            Debug.Log ("Native ad loaded.");

            Debug.Log ("Loading images...");
            // Use helper methods to load images from native ad URLs
            StartCoroutine (nativeAd.LoadIconImage (nativeAd.IconImageURL));
            StartCoroutine (nativeAd.LoadCoverImage (nativeAd.CoverImageURL));
            Debug.Log ("Images loaded.");
            title.text = nativeAd.Title;
            socialContext.text = nativeAd.SocialContext;
            callToAction.text = nativeAd.CallToAction;
errorHandle.text = ("Loaded");

        });
        nativeAd.NativeAdDidFailWithError = (delegate(string error) {
            Debug.Log ("Native ad failed to load with error: " + error);
errorHandle.text = ("error");


        });
        nativeAd.NativeAdWillLogImpression = (delegate() {
            Debug.Log ("Native ad logged impression.");
        });
        nativeAd.NativeAdDidClick = (delegate() {
            Debug.Log ("Native ad clicked.");
        });

        // Initiate a request to load an ad.
        nativeAd.LoadAd ();
    }

    void OnGUI ()
    {
        // Update GUI from native ad
        coverImage.sprite = nativeAd.CoverImage;
        iconImage.sprite = nativeAd.IconImage;
    }
}

This is how far I've gotten:
Code: [Select]

namespace HutongGames.PlayMaker.Actions {

[ActionCategory("Facebook Adverts")]
[Tooltip("Load adverts")]

//[RequireComponent (typeof(CanvasRenderer))]
//[RequireComponent (typeof(RectTransform))]

public class LoadFBAdvert : FsmStateAction {

[Header("Images:")]
[RequiredFieldAttribute]
public FsmString title;
[RequiredFieldAttribute]
public FsmString socialContext;

[RequiredFieldAttribute]
[CheckForComponent(typeof(Image))]
public FsmObject coverImage;

[RequiredFieldAttribute]
[CheckForComponent(typeof(Image))]
public FsmObject iconImage;

[RequiredFieldAttribute]
public FsmString callToAction;
[RequiredFieldAttribute]
[CheckForComponent(typeof(Button))]
public FsmObject callToActionButton;

private NativeAd nativeAd;




[RequiredFieldAttribute]
public FsmEvent AdvertSuccessful;
[RequiredFieldAttribute]
public FsmEvent AdvertFailed;


public override void OnEnter()
{

// Create a native ad request with a unique placement ID (generate your own on the Facebook app settings).
// Use different ID for each ad placement in your app.
NativeAd nativeAd = new AudienceNetwork.NativeAd ("319403784850492_327199570737580");
this.nativeAd = nativeAd;

// Wire up GameObject with the native ad; the specified buttons will be clickable.

nativeAd.RegisterGameObjectForImpression (gameObject, new Button[] { callToActionButton });

}

}
}

I don't know what this means:
Code: [Select]
nativeAd.RegisterGameObjectForImpression (gameObject, new Button[] { callToActionButton });

i know I'm doing something wrong here saving the variables - but i don't understand the basics. game object gives a red error.
can anyone pleaser assist me? maybe even explain what exactly one needs to do in an instance like this.

thanks

2
Playmaker Help / how to create objects in a foreach loop[SOLVED]
« on: December 29, 2015, 03:58:05 AM »
hey peeps

I'm trying to create an object in a foreach loop but get this error:
"INTERNAL_CALL_Internal_InstantiateSingle can only be called from the main thread."

here is my code:
Code: [Select]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
//using Facebook.Unity;
using Parse;

namespace HutongGames.PlayMaker.Actions {

[ActionCategory("DataParse")]
[Tooltip("Parse Scripts")]

public class DataParseSelect : FsmStateAction {
public FsmString UserID_, UserName_, UserGeoXLongitude_, UserGeoYLatitude_, UserVideoID_, UserVideoURL_;
string UserID, UserName, UserGeoXLongitude, UserGeoYLatitude, UserVideoID, UserVideoURL;

//luke

//public Transform prefab;


//playmaker stuff
[Tooltip("GameObject to create. Usually a Prefab.")]
public FsmGameObject gameObject;

[Tooltip("Position. If a Spawn Point is defined, this is used as a local offset from the Spawn Point position.")]
public FsmVector3 position;

[Tooltip("Optionally store the created object.")]
public FsmGameObject storeObject;




public FsmInt row;

public override void OnEnter()
{
row = 0;
DataParseQuerySelect ();

Finish ();

}

void DataParseQuerySelect()
{
try{
var query = ParseObject.GetQuery("hwsh_user_data");
query.FindAsync().ContinueWith(t =>
                               {
IEnumerable<ParseObject> results = t.Result;
foreach (var obj in results)
{
UserID = obj.Get<string>("User_ID");
UserName = obj.Get<string>("User_Name");
UserGeoXLongitude = obj.Get<string>("User_GeoX_Longitude");
UserGeoYLatitude = obj.Get<string>("User_GeoY_Latitude");
UserVideoID = obj.Get<string>("User_Video_ID");
UserVideoURL = obj.Get<string>("User_Video_URL");

Debug.Log(UserID.ToString() + " - " + UserName.ToString() + " - " + UserGeoXLongitude.ToString() + " - " + UserGeoYLatitude.ToString() + " - " + UserVideoID.ToString());

UserID_.Value = UserID;
UserName_.Value = UserName;
UserGeoXLongitude_.Value = UserGeoXLongitude;
UserGeoYLatitude_.Value = UserGeoYLatitude;
UserVideoID_.Value = UserVideoID;
UserVideoURL_.Value = UserVideoURL;
CreateMyMarkerObject();




//row.Value = row.Value + 1;
}
});
}
catch
{
Debug.Log ("Database query failed.");
}
}

public void CreateMyMarkerObject()
{
Debug.Log ("create my marker object");

var go = gameObject.Value;

if (go != null) {
var spawnPosition = Vector3.zero;
var spawnRotation = Vector3.zero;

var newObject = (GameObject)Object.Instantiate(go, spawnPosition, Quaternion.Euler(spawnRotation));


}
row.Value = row.Value + 1;

}
}
}

So the idea is that i am pulling information from parse. i then want to create a game object with the values. so where i am stuck at the moment is just creating a object for each entry.

please can anyone assist.


3
Playmaker Help / help with writing custom action for Facebook sdk
« on: November 28, 2015, 11:14:01 AM »
Hey peeps

I'm trying to write a custom action that will get the profile image and store it in a variable here i have provided the code. I'm a complete noob so i know i just need some assistance here. but how can i make my ProfileImage = UserAvatar or must i only use Fsm objects?

Code: [Select]
using UnityEngine;
using System.Collections;
using Facebook.Unity;
using UnityEngine.UI;



namespace HutongGames.PlayMaker.Actions {

[ActionCategory("Facebook")]
[Tooltip("Facebook Login")]

public class Facebook_Login : FsmStateAction {

[UIHint(UIHint.Variable)]
public FsmObject ProfileImage;

[UIHint(UIHint.Variable)]
public FsmInt FsmPublicIntTest;
//public FsmI

[UIHint(UIHint.Variable)]
private GameObject UIFBAvatar;

[UIHint(UIHint.Variable)]
private int privateIntTest;


public override void Reset() {

}

public override void OnEnter()
{
DoMyAction();
}

void DoMyAction()
{

FB.LogInWithReadPermissions ();
AreWeLoggedIn ();


}

void GetFacebookProfilePicture(){

Debug.Log("GetFacebookProfilePicture");

FB.API (Util.GetPictureURL ("/me", 128, 128), HttpMethod.GET, ProfilePhotoCallback);
}

private void ProfilePhotoCallback (IGraphResult result)
{
Debug.Log("FProfilePhotoCallback");

Image UserAvatar = UIFBAvatar.GetComponent<Image>();
UserAvatar.sprite = Sprite.Create (result.Texture, new Rect (0, 0, 128, 128), new Vector2 (0, 0));

ProfileImage = UserAvatar;

}


public void AreWeLoggedIn(){

Debug.Log("AreWeLoggedIn");

if (FB.IsLoggedIn) {

Debug.Log ("going to get picture");
GetFacebookProfilePicture ();

} else {
Debug.Log ("error");

}
}

}

}

thanks in advance

4
Playmaker Help / Help with if statement && operand
« on: November 01, 2015, 01:04:17 AM »
Im trying to follow the new tank tutorial on the unity website by re creating it with playmaker and I'm stuck with some logic.

here is an if statement that i just don't know how to translate back into playmaker can anyone please assist me.

if (Mathf.Abs (m_MovementInputValue) < 0.1f && Mathf.Abs (m_TurnInputValue) < 0.1f)

thanks in advance

5
Hey peeps

don't know if you guys know substance designer, but its really hot right now. you can build your own PBR shaders. all kinds of neat tricks can be done with it. check it out!!!

I need some help with changing the material parameter on .sbsar file that substance designer makes. it is a replacement for material, well actually it is a material its just called something .sbsar

So in substance designer i named the dirt level "dirt_level". substance designer provides a way to script it in unity so that you can do adjust these parameters. but i kinda can't code.

Ive watched the scripting videos on the playmaker youtube channel and have tried all the methods shown but no cigar. i also tried to do a set material float and that didn't work either.

is there a way to change it directly?

or
must i write a script and then use the send message action?


please any assistance will be appreciated.

6
Hey peeps.

ok so i wanted to convert my project to windows phone. firstly selecting the windows store, is this correct? my friend said that the section  "windows phone 8" is not correct - I'm already confused here is this right?

once converted i get 999+ errors mostly from the actions folder - can someone please help me by just telling me what to do to fix this.

so microsoft has given me a phone for a week to load it on there store, so I'm running out of time and need to give it back by friday.

Please, any assistance will be appreciated.

7
User Showcase / Rocket Rod - free on iOS
« on: June 27, 2015, 08:45:23 AM »
Hey peeps

Ive just launched rocket rod a 3d runner
its really basic and you collect coins to unlock different rocket rods (which i modelled and textured myself), you also earn coins by watching adverts.



check it out on the app store for free https://itunes.apple.com/us/app/rocket-rod/id984409649?ls=1&mt=8

there is so much more i could have done with this project but i decided to end it and move on. i redesigned the project so many times and had to do so many tweeks and
learned object pooling, it was a little bit of a nightmare to tell you the truth.

also another draw back is that it should be played on iPhone 5s and stronger - I've learned where the limits of unity are now and my next game is sure to implement everything I've learned thus far.

hope you guys enjoy it

Rock on!

8
Playmaker Help / how to click on text
« on: May 20, 2015, 06:31:05 AM »
Hey peeps

i have a game where i mix up words and out put the value to text objects. can i have direct interaction on them or must it be a fake button?

the problem is that i want the touch to happen immediately not when the button is released.

help anyone please

9
Playmaker Help / Triggers randomly missfire[SOLVED]
« on: May 17, 2015, 01:32:20 AM »
Hey peeps

attached is the FSM that shows you whats happens in my "CODE"

basically i have a trigger, when that fires. the object is moved to a spawn point,which is attached to the player(which is always 600 units ahead of the player).
so theoretically the room just changes position, and thus because i have a couple in my scene the rooms should build themselves. 3D Runner

but what happens is sometimes they don't trigger. i run my game and randomly they will misfire and I'm left with a gap. then if i pause my scene and move the player before that specific trigger (even though it is now passed through it and should have triggered, IT triggers, omg.

I don't understand why, can anyone please help me solve this

thank you anyone for just reading this.
rock on!

Pages: [1]